Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(cymbal): flush the SDK in the posthog capture test wait loop (#84892)

Thiago Salvatoredb487b973fbf
diff --git a/rust/cymbal/tests/posthog_capture.rs b/rust/cymbal/tests/posthog_capture.rs
index 8cf264341d4d..4f306befc955 100644
--- a/rust/cymbal/tests/posthog_capture.rs
+++ b/rust/cymbal/tests/posthog_capture.rs
@@ -84,8 +84,12 @@ async fn pipeline_failure_is_captured_as_posthog_exception(db: PgPool) {
reqwest::StatusCode::INTERNAL_SERVER_ERROR
);
- // The capture is fire-and-forget; wait for it to reach the mock server.
+ // The capture is fire-and-forget, and the SDK only buffers it: one event
+ // never reaches `flush_at`, so delivery would otherwise wait on the 5s
+ // `flush_interval_ms`. Flush every turn so this waits on the spawned send
+ // rather than racing that interval.
for _ in 0..100 {
+ posthog_rs::flush().await;
if capture.hits_async().await > 0 {
break;
}