import { Duration, Effect } from "effect";
Effect.runFork(
Effect.gen(function* () {
yield* Effect.logInfo("start");
yield* Effect.all(
[
Effect.gen(function* () {
yield* Effect.sleep(Duration.seconds(5));
yield* Effect.logInfo("task 1");
}).pipe(
// If I remove this timeout, only "start" and "interrupt" are logged (As I would expect)
Effect.timeout(Duration.seconds(10))
),
Effect.gen(function* () {
yield* Effect.sleep(Duration.seconds(2));
yield* Effect.logInfo("interrupt");
yield* Effect.interrupt;
}),
],
{ concurrency: 2 }
);
yield* Effect.logInfo("done");
})
);
import { Duration, Effect } from "effect";
Effect.runFork(
Effect.gen(function* () {
yield* Effect.logInfo("start");
yield* Effect.all(
[
Effect.gen(function* () {
yield* Effect.sleep(Duration.seconds(5));
yield* Effect.logInfo("task 1");
}).pipe(
// If I remove this timeout, only "start" and "interrupt" are logged (As I would expect)
Effect.timeout(Duration.seconds(10))
),
Effect.gen(function* () {
yield* Effect.sleep(Duration.seconds(2));
yield* Effect.logInfo("interrupt");
yield* Effect.interrupt;
}),
],
{ concurrency: 2 }
);
yield* Effect.logInfo("done");
})
);