const workFiber = Effect.gen(function* () {
const heartbeatFiber = yield* heartbeat.pipe(
Effect.repeat(Schedule.spaced("5000 millis")),
Effect.forkScoped,
);
yield* doWork().pipe(Effect.ensuring(Fiber.interrupt(heartbeatFiber)));
}).pipe(Effect.scoped);
const workFiber = Effect.gen(function* () {
const heartbeatFiber = yield* heartbeat.pipe(
Effect.repeat(Schedule.spaced("5000 millis")),
Effect.forkScoped,
);
yield* doWork().pipe(Effect.ensuring(Fiber.interrupt(heartbeatFiber)));
}).pipe(Effect.scoped);