: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(session-replay): yield the event loop between anonymized ml-mirror messages (#67277)
Tue Haulund550f647b82df
diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/anonymize/anonymize-event.ts b/nodejs/src/ingestion/pipelines/sessionreplay/anonymize/anonymize-event.tsindex b4b66e77debe..aa4ca0a96460 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/anonymize/anonymize-event.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/anonymize/anonymize-event.ts@@ -15,6 +15,8 @@ import { scrubConsolePlugin, scrubGenericField, scrubNetworkPlugin } from './valconst NETWORK_PLUGIN = 'rrweb/network@1'const CONSOLE_PLUGIN = 'rrweb/console@1'+const yieldToEventLoop = (): Promise<void> => new Promise((resolve) => setImmediate(resolve))+/*** Anonymizes every event in a parsed message in place, then awaits its blur jobs.* Fails closed: returns `failed: true` if any event errors, so the caller can drop@@ -42,6 +44,8 @@ export async function anonymizeParsedMessage(}await runBlurJobs(blurJobs)+ // Macrotask break so a batch of messages doesn't scrub fully synchronously and starve the loop.+ await yieldToEventLoop()return { failed: false }}