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

Fix shutdown signal handling in signer loop #409

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

ok300
Copy link
Contributor

@ok300 ok300 commented Apr 17, 2024

This PR is ported from breez/breez-sdk-greenlight#936

The original PR fixes an issue where signer.run_once can block for up to 10 minutes. This means that, if the signer was recently used, the signer loop would block on this call and disregard the shutdown signal for up to 10 minutes. The fix was to place the entire (inner) signer loop in a tokio::select, next to the shutdown signal handling.

The first part of the signer loop (scheduler initialization and maybe_upgrade) was extracted to a separate method as well. This part is not affected by the shutdown signal.

Note: in our version of the loop, we use wait = false, whereas here it is true. This could mean run_once behaves differently for you and might not block in the first place, but I'm not sure.

@cdecker
Copy link
Collaborator

cdecker commented Apr 17, 2024

ACK 61346c3

🚀

@cdecker cdecker merged commit 1d44455 into Blockstream:main Apr 17, 2024
19 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.

2 participants