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

Wait for all tasks to finish on shutdown #259

Merged
merged 1 commit into from
Aug 20, 2022
Merged

Wait for all tasks to finish on shutdown #259

merged 1 commit into from
Aug 20, 2022

Conversation

bachya
Copy link
Owner

@bachya bachya commented Aug 20, 2022

Describe what the PR does:

The Runtime object's shutdown is a bit fire-and-forget: we instruct all tasks to cancel, wait for 1 extra iteration of the event loop, and trust that everything cancels correctly. This works, but it's lucky.

This PR modifies things so that as soon as either runtime task is canceled, Runtime waits for both tasks to actually finish canceling before exiting.

Does this fix a specific issue?

N/A

Checklist:

  • Confirm that one or more new tests are written for the new functionality.
  • Run tests and ensure everything passes (with 100% test coverage).
  • Update README.md with any new documentation.
  • Add yourself to AUTHORS.md.

@bachya bachya added the maintenance Generic library tasks label Aug 20, 2022
@bachya bachya self-assigned this Aug 20, 2022
@bachya bachya added bug Bugs or issues which will cause a problem for users and removed maintenance Generic library tasks labels Aug 20, 2022
@codecov
Copy link

codecov bot commented Aug 20, 2022

Codecov Report

Merging #259 (e11f018) into dev (4006540) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               dev      #259   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines         1014      1018    +4     
=========================================
+ Hits          1014      1018    +4     
Impacted Files Coverage Δ
ecowitt2mqtt/runtime.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bachya bachya merged commit 7ccd239 into dev Aug 20, 2022
@bachya bachya deleted the shutdown branch August 20, 2022 20:06
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs or issues which will cause a problem for users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant