cuprated: Add graceful shutdown, pt3: Exit codes and main error propagation#590
Open
redsh4de wants to merge 27 commits intoCuprate:mainfrom
Open
cuprated: Add graceful shutdown, pt3: Exit codes and main error propagation#590redsh4de wants to merge 27 commits intoCuprate:mainfrom
main error propagation#590redsh4de wants to merge 27 commits intoCuprate:mainfrom
Conversation
2ae1e5e to
359d468
Compare
359d468 to
59248a6
Compare
59248a6 to
0fcfe5d
Compare
0fcfe5d to
43a1bfb
Compare
43a1bfb to
6763dd6
Compare
6763dd6 to
2984084
Compare
…erHandle, doc nits
2984084 to
6e6048d
Compare
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<AtomicBool>flag,spawn_criticalsets it on error,has_failed()function for exit code decisionHow
main_inner()returnsanyhow::Result<ExitCode>. Startup errors propagate tomain(), which prints them witheprintln_redand returnsExitCode::FAILURE.For runtime errors,
spawn_criticalsets anAtomicBoolflag on theTaskExecutorbefore triggering shutdown. After the runtime is dropped,main()readshas_failed()to decide betweenExitCode::SUCCESSandExitCode::FAILURE.