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

Wake up sleeping main thread upon receiving a signal #207

Merged
merged 3 commits into from
Jul 1, 2018
Merged

Conversation

orien
Copy link
Member

@orien orien commented Jun 28, 2018

Context

We have a custom event source with a long polling interval (5 minutes). This plays havoc with the Event Sourcery graceful shutdown mechanism as it will take up to 5 minutes to stop.

We set @shutdown_requested upon receiving SIGTERM. But we only check @shutdown_request after waking from the poll wait sleep.

Change

Instruct the main thread to wake upon receiving SIGTERM or SIGINT. So we don't wait the remainder of the poll wait sleep.

Copy link
Contributor

@stevehodgkiss stevehodgkiss left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@macosgrove macosgrove left a comment

Choose a reason for hiding this comment

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

Thanks Orien! LGTM

@orien orien merged commit d9d5f43 into master Jul 1, 2018
@orien orien deleted the wakeup_thread branch July 1, 2018 23:17
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.

3 participants