PostHog / PostHog/posthog-python

Backpressure when queue is full

Open
#146 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
61
Forks
82
Avg merge
1d 15h
Merged PRs (30d)
71

Description

We uncovered a case where a key customer was losing events due to the way this library is configured/built.

With the flush_interval=2 (default is 0.5), flush_at=100 and max_queue_size=1000 (default 10k), their queue got full during peak hours and they started dropping events.

Their recommended solution is very reasonable:

Ideally the library would provide back pressure by blocking/waiting for acknowledgement when flushing a batch of events vs having to configure a max_queue_size.

We should implement some way to block when the queue is full, or some way to let the user know the queue size.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by tracing how flush_interval, flush_at, and max_queue_size control event delivery, then clarify whether the intended behavior is blocking on a full queue or exposing its size. Done should include a defined queue-full behavior and coverage for the reported event-loss case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.