Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dim logs on shutdown #3235

Merged
merged 8 commits into from
May 9, 2024
Merged

Conversation

joske
Copy link
Contributor

@joske joske commented Apr 25, 2024

This PR implements log dimming (if running in TTY mode) on shutdown (CTRL-C handler).

I've moved the shutdown flag earlier in the startup so it can be reused for the log dimming too.

There is some performance impact as it needs to check the boolean for every log event (and an extra method call).

@joske joske force-pushed the feat/dim_logs branch 3 times, most recently from a325a07 to 92592ca Compare April 25, 2024 11:19
Copy link
Contributor

@iamalwaysuncomfortable iamalwaysuncomfortable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @joske, I'll try to run this later today. Is it possible to add an explicit message in the terminal to wait for shutdown to complete?

cli/src/commands/start.rs Outdated Show resolved Hide resolved
node/src/traits.rs Outdated Show resolved Hide resolved
node/src/validator/mod.rs Outdated Show resolved Hide resolved
node/tests/common/node.rs Outdated Show resolved Hide resolved
node/tests/common/node.rs Outdated Show resolved Hide resolved
node/tests/common/node.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@ljedrz ljedrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few nits.

@joske joske force-pushed the feat/dim_logs branch 2 times, most recently from 15b11b7 to de654b3 Compare April 30, 2024 11:37
@niklaslong
Copy link
Collaborator

CircleCi is having a moment, that failure is unrelated to the changes. Let's try rerunning a little later.

Copy link
Collaborator

@niklaslong niklaslong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (also tested locally) 👍

Copy link
Contributor

@iamalwaysuncomfortable iamalwaysuncomfortable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial message needs to be a bit more clear and should probably be highlighted or bolded. I've included a suggestion for wording.

Also:

  • During shutdown, are any further SIGINT/SIGHUP/SIGTERM signals caught & ignored so that graceful shutdown can continue?
  • I think this work is a good start, but in a follow-on PR we should maybe consider launching a display which displays graceful shutdown warnings more prominently.

node/src/traits.rs Outdated Show resolved Hide resolved
@howardwu howardwu merged commit 8836506 into AleoNet:mainnet-staging May 9, 2024
0 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants