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

#133: Fix task cancellation breaking broadcast loop #134

Merged

Conversation

not-f-elsner
Copy link
Collaborator

@not-f-elsner not-f-elsner commented Feb 6, 2023

  • Differentiate between broadcast shutdown and task cancellation
  • Minor refactor to make the code more readable
  • Improved and simplified logging

Closes: #133

@not-f-elsner not-f-elsner force-pushed the 133-broadcast-cancellation branch 6 times, most recently from 3e7423e to 2f08a32 Compare February 6, 2023 11:05
@not-f-elsner not-f-elsner changed the title 133: Fix task cancellation breaking broadcast loop #133 : Fix task cancellation breaking broadcast loop Feb 6, 2023
@not-f-elsner not-f-elsner changed the title #133 : Fix task cancellation breaking broadcast loop #133 DRAFT : Fix task cancellation breaking broadcast loop Feb 6, 2023
@not-f-elsner not-f-elsner changed the title #133 DRAFT : Fix task cancellation breaking broadcast loop #133: Fix task cancellation breaking broadcast loop Feb 6, 2023
- Differentiate between broadcast shutdown and task cancellation
- Minor refactor to make the code more readable
- Improved and simplified logging
@not-f-elsner
Copy link
Collaborator Author

I looked into simply adding the CancelledError to the exceptions which we except when doing task.result(), but we cannot differentiate between the task itself being cancelled by the handler, and the task being cancelled due to the broker shutting down the loop, hence the slightly more complicated logic for loop shutdown

See the example: https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.cancel

amqtt/broker.py Outdated Show resolved Hide resolved
@FlorianLudwig FlorianLudwig merged commit 3bf29cf into Yakifo:master Feb 9, 2023
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.

Bug: Cancellation of MQTT publish in _broadcast_loop leaves the broker non functional
3 participants