Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Stack-overflow during shutdown
Browse files Browse the repository at this point in the history
Nukesor committed Jun 23, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
kaloudis Evan Kaloudis
1 parent bd4e7cf commit 4fe6c23
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pueue/src/daemon/process_handler/mod.rs
Original file line number Diff line number Diff line change
@@ -17,9 +17,13 @@ pub mod start;
/// We don't have to pause any groups, as no new tasks will be spawned during shutdown anyway.
/// Any groups with queued tasks, will be automatically paused on state-restoration.
pub fn initiate_shutdown(settings: &Settings, state: &mut LockedState, shutdown: Shutdown) {
state.shutdown = Some(shutdown);

self::kill::kill(settings, state, TaskSelection::All, false, None);
// Only start shutdown if we aren't already in one.
// Otherwise, we might end up with an endless recursion as `kill` might fail and initiate shutdown
// once again.
if state.shutdown.is_none() {
state.shutdown = Some(shutdown);
self::kill::kill(settings, state, TaskSelection::All, false, None);
}
}

/// This is a small wrapper around the real platform dependant process handling logic

0 comments on commit 4fe6c23

Please sign in to comment.