Skip to content

Add public bounded flush API #145

Description

@marandaneto

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: PostHog/posthog-python#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions