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:
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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user