Repository navigation
fix: release exited threads' consumers; release 0.1.1 - #20
Merged
Merged
Conversation
With consumer_factory, the client held every consumer it had made, and events buffered by exited threads waited until the next flush(). A thread's consumer is now flushed and released when the thread exits, and flush() releases any exited thread's consumer still held. Leaving a with block that raised no longer replaces its exception with a flush error under on_error="raise"; the flush error is logged. Also limit the mixpanel extra to <6, fall back to __version__ 0.0.0, and release 0.1.1. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CVp1mE8TsPmfiRgNEZPzg5
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CVp1mE8TsPmfiRgNEZPzg5
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the issues the Everygene agent found while reviewing 0.1.0 for adoption.
Changes
consumer_factory, the client kept every consumer it had ever made, so each short-lived thread (for example an idle worker that a thread pool retires) added one, and its buffered events waited until the nextflush(). Now, when a thread exits, Python releases that thread'sMixpanelinstance, and aweakref.finalizehook flushes and releases its consumer. The hook holds only a weak reference to the client. A flush error at that point is logged, since no caller is left to raise to (nothing is logged withon_error="ignore"). As a backup,flush()also flushes and releases any consumer still held for a thread that has exited.withblock raises, a flush error on exit is logged, so the block's own exception propagates. When the block exits normally, a flush error is still raised underon_error="raise".mixpanelextra is now>=4.0,<6.__version__fallback is now0.0.0instead of a hardcoded version that would go stale.poetry lockonly merged the lock's twotyping-extensionsentries into one.Tests
There are 9 new tests, 116 in total. Five of them fail against
main:on_error="ignore".flush()releases an exited thread's consumer that is still referenced.withblock that raised doesn't replace the original exception.The other four guard behavior that already worked: a live thread's consumer is kept, a live thread doesn't keep the client alive, and a flush error still raises when the block exits normally.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CVp1mE8TsPmfiRgNEZPzg5