-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add forking helpers * Add disable_background_sender method. * Add stop method. * Add opt-out * Simplify locking Instead of separate locks for buffering and sender modes configuration, use the same lock. * Move locks out of _start/_stop_sender_thread methods * Don't start flush thread if we are about to fork * Add per-instance opt-out from tracking * Document global fork hooks * Remove warning when stopping already stopped thread Now that disable_buffering and pre_fork may both try to stop the flush thread at the same time, attempt to stop an already stopped thread does not indicate a bug in the client code. * Remove some redundant locking Single field assignement is atomic according to Python FAQ, so we don't need to protect reads and writes to self._queue as such. The only place where we need a lock is when stopping the sender, to ensure that the Stop marker is the last thing to be placed in there. https://docs.python.org/3/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe * Add type annotation for mypy * Silence type error on os.register_at_fork os.register_at_fork is not available on all python versions, notably python 2.7. While we check for the availability explicitly, mypy cannot see through that and complains. * Fix formatting * Fix docstring * Update docs to reference stop() rather than wait_for_pending(). * Update docstring for enable_background_sender The method is now thread safe, and can be used with forking applications. * Fix docstring for enable_background_sender Re-format parameter descriptions so they are rendered correctly in the html docs. * Document new environment variables.
- Loading branch information
Showing
4 changed files
with
276 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.