-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix: worker: listen for interrupt signals in GetStorageMinerAPI loop #11309
Conversation
- Added a goroutine to listen for interrupt signals, which will cancel the current context when an interrupt signal is received. This allows for graceful shutdown of ongoing operations.
cmd/lotus-worker/main.go
Outdated
defer closer() | ||
ctx, cancel := context.WithCancel(ctx) | ||
ctx, cancel = context.WithCancel(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be able to drop this.
(also, this will re-assign cancel
, leading to a data race with the goroutine above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped this here: f759f4d
Remove redundant context cancellation in lotus worker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, otherwise LGTM. Sorry for the delay, I didn't notice your changes. Feel free to bug me on slack if I'm not responsive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, I just removed the offending line.
Proposed Changes
Listen for interrupt signals in GetStorageMinerAPI loop, allowing for graceful shutdown in case the worker is brought up before the lotus-miner process is running.
Additional Info
Before:
After:
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, testarea
, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps