Skip to content

fix: increase default flush interval#2

Closed
marandaneto wants to merge 4 commits into
Kshitijmishradev:mainfrom
PostHog:fix/default-flush-interval-5s
Closed

fix: increase default flush interval#2
marandaneto wants to merge 4 commits into
Kshitijmishradev:mainfrom
PostHog:fix/default-flush-interval-5s

Conversation

@marandaneto

Copy link
Copy Markdown

💡 Motivation and Context

The Python SDK currently flushes partial background batches after 500ms by default, which is much more aggressive than the other backend SDK defaults. This increases the default background flush interval to 5 seconds while keeping the existing flush_at = 100 count trigger.

Default backend SDK context:

SDK Default flush interval Count trigger
posthog-python before this PR 500 ms flush_at = 100
posthog-python after this PR 5,000 ms flush_at = 100
posthog-dotnet 30,000 ms FlushAt = 20
posthog-go 5,000 ms BatchSize = 250
posthog-elixir 10,000 ms max_batch_events = 100
posthog-js / posthog-node 10,000 ms flushAt = 20
posthog-php No timer batch_size = 100; flushes on batch size/manual/destruct
posthog-ruby No fixed timer batch_size = 100; worker sends queued events immediately
posthog-rs No internal queue timer Captures send immediately; batching is explicit

💚 How did you test it?

  • uv run python .github/scripts/check_public_api.py
  • uv run pytest posthog/test/test_consumer.py posthog/test/test_client.py::TestClient::test_user_defined_flush_at

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

An agent updated the Python client and consumer default flush interval from 0.5s to 5s, aligned the SDK compliance adapter default flush_interval_ms to 5000, regenerated the public API snapshot, and added a Sampo changeset. The default-values table above was gathered from the locally cloned PostHog SDK repositories to give reviewers cross-SDK context for the chosen 5s value.

dustinbyrne and others added 4 commits June 15, 2026 18:14
* chore: add AI contribution policy

* docs: avoid hardcoded year in AI policy
…-openai-agents (#670)

chore(deps): bump pyjwt in /examples/example-ai-openai-agents

Bumps [pyjwt](https://github.com/jpadilla/pyjwt) from 2.12.1 to 2.13.0.
- [Release notes](https://github.com/jpadilla/pyjwt/releases)
- [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst)
- [Commits](jpadilla/pyjwt@2.12.1...2.13.0)

---
updated-dependencies:
- dependency-name: pyjwt
  dependency-version: 2.13.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…-pydantic-ai (#669)

chore(deps): bump pyjwt in /examples/example-ai-pydantic-ai

Bumps [pyjwt](https://github.com/jpadilla/pyjwt) from 2.12.1 to 2.13.0.
- [Release notes](https://github.com/jpadilla/pyjwt/releases)
- [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst)
- [Commits](jpadilla/pyjwt@2.12.1...2.13.0)

---
updated-dependencies:
- dependency-name: pyjwt
  dependency-version: 2.13.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@marandaneto

Copy link
Copy Markdown
Author

Closing duplicate; opened upstream PR at PostHog#672.

@marandaneto marandaneto deleted the fix/default-flush-interval-5s branch June 17, 2026 13:54
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.

2 participants