@@ -51,7 +51,7 @@ pub enum NodeGraphUpdate {
5151pub struct NodeGraphExecutor {
5252 runtime_io : NodeRuntimeIO ,
5353 current_execution_id : u64 ,
54- futures : HashMap < u64 , ExecutionContext > ,
54+ futures : VecDeque < ( u64 , ExecutionContext ) > ,
5555 node_graph_hash : u64 ,
5656 previous_node_to_inspect : Option < NodeId > ,
5757}
@@ -157,7 +157,7 @@ impl NodeGraphExecutor {
157157 // Execute the node graph
158158 let execution_id = self . queue_execution ( render_config) ;
159159
160- self . futures . insert ( execution_id, ExecutionContext { export_config : None , document_id } ) ;
160+ self . futures . push_back ( ( execution_id, ExecutionContext { export_config : None , document_id } ) ) ;
161161
162162 Ok ( DeferMessage :: SetGraphSubmissionIndex { execution_id } . into ( ) )
163163 }
@@ -213,7 +213,7 @@ impl NodeGraphExecutor {
213213 export_config : Some ( export_config) ,
214214 document_id,
215215 } ;
216- self . futures . insert ( execution_id, execution_context) ;
216+ self . futures . push_back ( ( execution_id, execution_context) ) ;
217217
218218 Ok ( ( ) )
219219 }
@@ -273,7 +273,19 @@ impl NodeGraphExecutor {
273273 responses. extend ( existing_responses. into_iter ( ) . map ( Into :: into) ) ;
274274 document. network_interface . update_vector_modify ( vector_modify) ;
275275
276- let execution_context = self . futures . remove ( & execution_id) . ok_or_else ( || "Invalid generation ID" . to_string ( ) ) ?;
276+ while let Some ( & ( fid, _) ) = self . futures . front ( ) {
277+ if fid < execution_id {
278+ self . futures . pop_front ( ) ;
279+ } else {
280+ break ;
281+ }
282+ }
283+
284+ let Some ( ( fid, execution_context) ) = self . futures . pop_front ( ) else {
285+ panic ! ( "InvalidGenerationId" )
286+ } ;
287+ assert_eq ! ( fid, execution_id, "Missmatch in execution id" ) ;
288+
277289 if let Some ( export_config) = execution_context. export_config {
278290 // Special handling for exporting the artwork
279291 self . export ( node_graph_output, export_config, responses) ?;
0 commit comments