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

Enable long running processes to be interrupted #426

Merged
merged 7 commits into from Sep 8, 2023

Conversation

jholdstock
Copy link
Member

Adds shutdown request handling for startup processes and long-running background tasks.

Requires #424

Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

Nice changes. I also appreciate that well crafted set of commits. It really helps with reviews when developers take the time to split changes up nicely like this.

cmd/vspd/vspd.go Outdated Show resolved Hide resolved
Using a single select loop for background tasks removes a lot of
duplicated boilerplate code and helps to simplify shutdown logic. This
does reduce the amount of things which can run in parallel, but that
isn't of concern for vspd. The web server still runs in its own
goroutine so its responsiveness won't be affected.
The more verbose name was helpful in the past when some code was
handling more than one context, however that is no longer the case due
to refactoring so reverting to the more concise name makes sense.
vspd runs some tasks on startup - database consistency checks, catching
up with missed blocks, etc. If a shutdown is requested while these tasks
are running, vspd should stop immediately rather than continuing to
start the web API server and other background tasks.
Add a Context parameter to findSpentTickets so it can be canceled when a
shutdown is requested.
Check the status of the Context in blockConnected so it can be canceled
when a shutdown is requested.
Add a Context parameter to checkWalletConsistency so it can be canceled
when a shutdown is requested.
@jholdstock jholdstock merged commit 841c8ba into decred:master Sep 8, 2023
2 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

2 participants