cuprated: Add graceful shutdown, pt3: Exit codes and main error propagation - #590
Merged
Merged
Conversation
redsh4de
marked this pull request as draft
March 1, 2026 09:47
redsh4de
marked this pull request as ready for review
March 1, 2026 14:41
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
March 15, 2026 23:23
2ae1e5e to
359d468
Compare
redsh4de
marked this pull request as draft
March 17, 2026 18:12
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
March 18, 2026 03:38
359d468 to
59248a6
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
March 19, 2026 00:42
59248a6 to
0fcfe5d
Compare
redsh4de
marked this pull request as ready for review
March 19, 2026 01:04
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
2 times, most recently
from
March 20, 2026 09:14
43a1bfb to
6763dd6
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
2 times, most recently
from
March 24, 2026 22:43
2984084 to
6e6048d
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
7 times, most recently
from
April 26, 2026 14:40
2f3a078 to
bb16a6c
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
April 26, 2026 19:53
bb16a6c to
b211471
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
2 times, most recently
from
May 5, 2026 17:04
4413d0f to
2da046f
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
May 12, 2026 15:58
2da046f to
8d9de5f
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
3 times, most recently
from
June 3, 2026 12:54
80fa6a9 to
eea7e15
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
June 15, 2026 09:32
eea7e15 to
b5e4c94
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
July 20, 2026 23:37
b5e4c94 to
b67d489
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
3 times, most recently
from
July 27, 2026 06:01
4181eba to
38c971f
Compare
9 tasks
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
3 times, most recently
from
August 5, 2026 21:45
6590ab4 to
74462b8
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
August 22, 2026 08:34
74462b8 to
83a8084
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
August 22, 2026 12:34
83a8084 to
1f059d7
Compare
redsh4de
force-pushed
the
feat/graceful-shutdown-pt3
branch
from
August 24, 2026 18:15
1f059d7 to
b649a81
Compare
Boog900
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Depends on #586
Building on part 2, this replaces hard exit and panics across cuprated's startup path with error propagation, introduces
ExitCodeto distinguish clean shutdowns from failures.Based off #528
Closes #522.
Where
cupratedmain.rs-main()returnsExitCode, newmain_inner()propagates all startup errors via?, removed allprocess::exit(1)calls from config/init pathmonitor.rs-TaskExecutornow hasfailed: Arc<OnceLock<&'static str>>,spawn_criticalrecords the failing task on failure, typedCriticalTaskErrorfor exit code decisionlib.rs-Node::wait_for_shutdownreturnsResult<(), CriticalTaskError>; returnsCriticalTaskErrorif a critical task failed after the drainHow
main_inner()returnsanyhow::Result<ExitCode>. Startup errors propagate tomain(), which prints them witheprintln_redand returnsExitCode::FAILURE.For runtime errors,
spawn_criticalrecords the failing task's name in aOnceLockon theTaskExecutorbefore triggering shutdown.wait_for_shutdownchecks it after draining all tasks and returnsErr(CriticalTaskError)if set - thatErrflows through?inmain_innertomain(), which prints and returnsExitCode::FAILURE. Clean shutdowns returnExitCode::SUCCESS.