Add public bounded flush API

Open
#145 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
elixir
Domain
backend

Research direction

Start by reading the PostHog.Sender implementation and the referenced sdk-specs flush specification to understand queue behavior and the required contract. Define the public PostHog.flush API, its named-instance and timeout behavior, then add tests and documentation showing empty queues, bounded waits, immediate delivery, and status reporting.

Written by the indexing model from the issue text.

Description

enhancement

Summary

Add a public bounded flush API.

Why

sdk-specs marks flush as applicable to both client and server SDKs. Backend users need deterministic delivery before process/request boundaries, tests, scripts, and serverless exits.

Current status

PostHog.Sender flushes on batch size, timer, and GenServer termination, but there is no public flush API. Python has a related issue about adding a max timeout to flush: https://github.com/PostHog/posthog-python/issues/79.

Suggested scope

  • Add a public PostHog.flush/1 or PostHog.flush/2 accepting a named instance and timeout.
  • Flush all sender queues immediately without waiting for threshold/timer.
  • Return safely when queues are empty.
  • Bound the wait with a timeout and return/report status rather than blocking indefinitely.
  • Preserve retryable failed events for future retry once retry queue support exists.
  • Add tests and docs.

References

Dominant language
Elixir
Stars
66
Forks
33
Avg merge
1d 22h
Merged PRs (30d)
21

Getting set up

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.

More from PostHog/posthog-elixir

All issues in PostHog/posthog-elixir

Similar issues

More Elixir issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.