Skip to content

Commit

Permalink
Dont use shutdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jan 14, 2025
1 parent 58cd682 commit fed370c
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions crates/action-pipeline/src/action_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl ActionPipeline {
// If the pipeline was aborted or cancelled (signal),
// loop through and abort all currently running handles
if job_context.is_aborted_or_cancelled() {
job_handles.shutdown().await;
exhaust_job_handles(&mut job_handles, &job_context).await;

// Return instead of break, so that we avoid
// running persistent tasks below
Expand Down Expand Up @@ -360,7 +360,7 @@ impl ActionPipeline {
if job_context.is_aborted_or_cancelled() {
debug!("Shutting down {} persistent jobs", job_handles.len());

job_handles.shutdown().await;
exhaust_job_handles(&mut job_handles, &job_context).await;
break;
}
}
Expand Down Expand Up @@ -490,19 +490,10 @@ async fn dispatch_job_with_permit(
#[instrument(skip_all)]
async fn exhaust_job_handles<T: 'static>(set: &mut JoinSet<T>, job_context: &JobContext) -> bool {
while set.join_next().await.is_some() {
// If the pipeline was aborted or cancelled (signal),
// loop through and abort all currently running handles
if job_context.is_aborted_or_cancelled() {
set.shutdown().await;
set.detach_all();

// Aborted
return true;
}
continue;
}

set.detach_all();

// Not aborted
false
job_context.is_aborted_or_cancelled()
}

0 comments on commit fed370c

Please sign in to comment.