File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,42 +226,6 @@ public async Task CancelStepsAsync(string[] cancelStepIds)
226226 }
227227 }
228228
229- /// <summary>
230- /// Cancel ALL active background steps. Used as a safety net before post-hooks.
231- /// </summary>
232- public async Task CancelAllAsync ( )
233- {
234- var activeIds = _backgroundSteps . Values
235- . Where ( bg => ! bg . IsCompleted )
236- . Select ( bg => bg . StepId )
237- . ToList ( ) ;
238-
239- if ( activeIds . Count == 0 ) return ;
240-
241- _trace . Info ( $ "Cancelling { activeIds . Count } active background step(s)...") ;
242- await CancelWithGracePeriodAsync ( activeIds , graceSeconds : 7.5 ) ;
243-
244- var stillRunning = activeIds
245- . Where ( id => _backgroundSteps . TryGetValue ( id , out var bg ) && ! bg . IsCompleted )
246- . ToList ( ) ;
247- if ( stillRunning . Count > 0 )
248- {
249- _trace . Info ( $ "{ stillRunning . Count } background step(s) did not terminate gracefully.") ;
250- var finalTasks = stillRunning
251- . Where ( id => _backgroundSteps . ContainsKey ( id ) )
252- . Select ( id => _backgroundSteps [ id ] . ExecutionTask )
253- . ToArray ( ) ;
254- try
255- {
256- await Task . WhenAll ( finalTasks ) . WaitAsync ( TimeSpan . FromSeconds ( 30 ) ) ;
257- }
258- catch ( TimeoutException )
259- {
260- _trace . Info ( "Background step(s) did not terminate within 30s. Proceeding with job cleanup." ) ;
261- }
262- }
263- }
264-
265229 // -----------------------------------------------------------------
266230 // Failure propagation
267231 // -----------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments