@@ -76,7 +76,9 @@ def _make_tracking_client() -> tuple[Mock, list]:
7676 calls : list [list ] = []
7777 mock_client = Mock (spec = LambdaClient )
7878
79- def _checkpoint (durable_execution_arn , checkpoint_token , updates , client_token = None ):
79+ def _checkpoint (
80+ durable_execution_arn , checkpoint_token , updates , client_token = None
81+ ):
8082 calls .append (list (updates ))
8183 return CheckpointOutput (
8284 checkpoint_token = f"token_{ len (calls )} " ,
@@ -113,9 +115,9 @@ def test_map_with_concurrent_waits_coalesces_empty_checkpoints():
113115
114116 def branch_work ():
115117 try :
116- start_barrier .wait () # all start simultaneously
117- state .create_checkpoint () # empty checkpoint, synchronous
118- except Exception as e : # noqa: BLE001
118+ start_barrier .wait () # all start simultaneously
119+ state .create_checkpoint () # empty checkpoint, synchronous
120+ except Exception as e : # noqa: BLE001
119121 errors .append (e )
120122
121123 threads = [threading .Thread (target = branch_work ) for _ in range (branch_count )]
@@ -156,7 +158,6 @@ def test_map_with_concurrent_waits_api_call_count_scales_with_real_ops_not_empti
156158 # limit = 1 (first empty) + 10 (real ops) = 11, so all fit in one batch
157159 state = _make_state (mock_client , batch_time = 5.0 , max_ops = 11 )
158160
159-
160161 completion_events : list [CompletionEvent ] = []
161162
162163 try :
@@ -173,13 +174,14 @@ def test_map_with_concurrent_waits_api_call_count_scales_with_real_ops_not_empti
173174 operation_type = OperationType .STEP ,
174175 action = OperationAction .START ,
175176 )
176- batcher = ThreadPoolExecutor (max_workers = 1 )
177- batcher .submit (state .checkpoint_batches_forever )
178-
177+
179178 ev = CompletionEvent ()
180179 completion_events .append (ev )
181180 state ._checkpoint_queue .put (QueuedOperation (op , ev )) # noqa: SLF001
182181
182+ batcher = ThreadPoolExecutor (max_workers = 1 )
183+ batcher .submit (state .checkpoint_batches_forever )
184+
183185 # Wait for all 410 to be processed
184186 for ev in completion_events :
185187 ev .wait ()
0 commit comments