File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
crates/torii/task-network/src Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -239,14 +239,24 @@ mod tests {
239
239
240
240
// Record execution state
241
241
{
242
- let current = currently_executing. lock ( ) . await ;
243
- let mut executed = executed_levels. lock ( ) . await ;
244
- executed. push ( ( id, current. clone ( ) ) ) ;
242
+ // First, get the current executing tasks
243
+ let current_executing = {
244
+ let current = currently_executing. lock ( ) . await ;
245
+ current. clone ( ) // Clone the data so we can release the lock
246
+ } ;
245
247
246
- // Remove from currently executing
247
- let mut current = currently_executing. lock ( ) . await ;
248
- if let Some ( pos) = current. iter ( ) . position ( |& x| x == id) {
249
- current. remove ( pos) ;
248
+ // Now update the executed_levels with the captured state
249
+ {
250
+ let mut executed = executed_levels. lock ( ) . await ;
251
+ executed. push ( ( id, current_executing) ) ;
252
+ }
253
+
254
+ // Finally, remove this task from currently executing
255
+ {
256
+ let mut current = currently_executing. lock ( ) . await ;
257
+ if let Some ( pos) = current. iter ( ) . position ( |& x| x == id) {
258
+ current. remove ( pos) ;
259
+ }
250
260
}
251
261
}
252
262
You can’t perform that action at this time.
0 commit comments