Skip to content

Analytics shutdown flush is best-effort and can be lost on process exit #58

Description

@khvn26

Following on from #55 / #57, the analytics thread now flushes buffered counts when its last sender drops, but nothing waits for that flush to finish.

We can fix that, however, we need to make design decisions around AnalyticsProcessor lifecycle to find the best place to block at. Right now, AnalyticsProcessor clones owned by Flags can outlive Flagsmith, which is arguably wrong.

Options

  1. Add explicit shutdown() on Flagsmith that closes the channel and joins with a bounded timeout; stop giving Flags an owning clone so the processor's lifetime is tied to Flagsmith alone.
  2. Leave it best-effort and document it.
  3. Something else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions