Skip to content

Conversation

joul87
Copy link

@joul87 joul87 commented Oct 8, 2025

Problem

The PostHog Python client had an issue with consumer management where the consumers list was being initialized inside the loop that creates consumer threads, causing uncontrolled consumer creation. This could lead to:

  • More consumers being created than intended
  • Potential resource leaks
  • Inconsistent behavior when multiple threads are specified

Solution

  • Moved consumer list initialization: Moved self.consumers = [] outside the thread creation loop to ensure the list is properly initialized before adding consumers
  • Added comprehensive test coverage: Created a test case test_number_of_consumers() to verify that the correct number of consumers are created based on the specified thread count

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.

1 participant