Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Apr 2, 2024
1 parent 4689df3 commit df7e0c0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ fn settings() -> io::Result<Settings> {
None => DEFAULT_DELETION_CHUNK_SIZE,
};

// Determine whether to exit immediately on error.
let fail_fast = matches.is_present(FAIL_FAST);

Ok(Settings {
Expand Down Expand Up @@ -275,13 +276,15 @@ fn main() {
|state| (state, false),
);

// Stream Docker events and vacuum when necessary. Restart if an error occurs.
// Stream Docker events and vacuum when necessary.
loop {
if let Err(e) = run(&settings, &mut state, &mut first_run) {
error!("{}", e);
// If we're in fail-fast mode, exit immediately.
if settings.fail_fast {
error!("Exiting due to --fail-fast");
exit(1);
// Otherwise, retry after a short delay.
} else {
error!("Retrying in 5 seconds\u{2026}");
sleep(Duration::from_secs(5));
Expand Down

0 comments on commit df7e0c0

Please sign in to comment.