Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/docs/experimentation/run-an-experiment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

</TabItem>
<TabItem value="java" label="Java">
Expand Down
5 changes: 2 additions & 3 deletions docs/docs/experimentation/set-up-with-a-coding-agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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/<environment key>/experiments/<id>/results/refresh/` (allowed once every 5 minutes) and
read `GET .../experiments/<id>/results/`. Finish with a link to the experiment:
<dashboard>/project/<project id>/environment/<environment key>/experiments/<id>, where the dashboard is
Expand Down
Loading