Scope telemetry flush loop to service lifecycle

- Replace detached flush worker with scoped fiber in `AnalyticsService`
- Ensure periodic analytics flushing is tied to layer lifetime/cleanup
This commit is contained in:
Julius Marminge authored and Julius Marminge committed 2026-03-05 23:40:49 -08:00
1 parent d21a8d597b
commit 91cf202177
1 file changed
+1 -1
@@ -134,7 +134,7 @@ const makeAnalyticsService = Effect.gen(function* () {
yield* Effect.forever(Effect.sleep(1000).pipe(Effect.flatMap(() => flush)), {
disableYield: true,
}).pipe(Effect.forkDetach);
}).pipe(Effect.forkScoped);
yield* Effect.addFinalizer(() => flush);