diff --git a/docs/docs/experimentation/run-an-experiment.mdx b/docs/docs/experimentation/run-an-experiment.mdx index b30d5038470b..88959e391697 100644 --- a/docs/docs/experimentation/run-an-experiment.mdx +++ b/docs/docs/experimentation/run-an-experiment.mdx @@ -210,10 +210,14 @@ flagsmith = Flagsmith( # events_api_url="https://events.flagsmith.example.com/", # ), ) + +# Before your application exits +flagsmith.close() ``` -Events still buffered when the interpreter exits are dropped. In short-lived scripts and jobs, pass `max_buffer_items=1` -to `EventProcessorConfig` so each event is sent as it is tracked. +The client does not send buffered events by itself when the interpreter exits, so call `close()` from your framework's +shutdown hook, or register it with `atexit.register(flagsmith.close)`. It waits up to 5 seconds for the events to be +sent; pass `timeout_seconds` to change that. diff --git a/docs/docs/experimentation/set-up-with-a-coding-agent.mdx b/docs/docs/experimentation/set-up-with-a-coding-agent.mdx index 2d5173f0a028..64e0849dacd6 100644 --- a/docs/docs/experimentation/set-up-with-a-coding-agent.mdx +++ b/docs/docs/experimentation/set-up-with-a-coding-agent.mdx @@ -107,9 +107,8 @@ If something fails, stop and show me the exact error; don't guess or work around 8. Offer to send test traffic with a short script that simulates a few hundred users, each with its own identifier: get the experiment flag for each one and track the event for some of them. The SDKs send events in batches, so - send what is left before the script exits: JavaScript `await flushEvents()`, Python - `EventProcessorConfig(max_buffer_items=1)`, Node.js `await close()`, Java `close()`, Go `FlushEvents(ctx)`, - Flutter `await flushEvents()`. About a minute later, call + send what is left before the script exits: JavaScript `await flushEvents()`, Python `close()`, Node.js + `await close()`, Java `close()`, Go `FlushEvents(ctx)`, Flutter `await flushEvents()`. About a minute later, call `POST api/v1/environments//experiments//results/refresh/` (allowed once every 5 minutes) and read `GET .../experiments//results/`. Finish with a link to the experiment: /project//environment//experiments/, where the dashboard is