Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants