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

AsyncTransport: eagerly process queue on stop() #888

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gjoseph92
Copy link

Sometimes, you don't want to just rely on the atexit handler, but manually shut down the AsyncTransport in your application and be sure all the logs are flushed from it. Calling .flush(); .stop() is not ideal, because flush could block for an unnecessarily long time. This PR:

  • sets the stop event in _Worker.stop, so the queue begins processing immediately
  • removes _Worker._export_pending_data, which became redundant, and just uses stop as the atexit handler
  • Exposes a public stop method on AsyncTransport
  • Driveby: clarify grace_period and wait_period units in docstring

Sometimes, you don't want to just rely on the `atexit` handler, but manually shut down the `AsyncTransport` in your application and be sure all the logs are flushed from it. Calling `.flush(); .stop()` is not ideal, because `flush` could block for an unnecessarily long time. This PR:

* sets the stop event in `_Worker.stop`, so the queue begins processing immediately
* removes `_Worker._export_pending_data`, which became redundant, and just uses `stop` as the atexit handler
* Exposes a public `stop` method on `AsyncTransport`
* Driveby: clarify `grace_period` and `wait_period` units in docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants