What version of Effect is running?
3.21.4
What steps can reproduce the bug?
Run the following code:
import { Effect, pipe } from 'effect';
const causeTimeout = pipe(
Effect.async(() => {}),
Effect.timeoutFail({
duration: '1 second',
onTimeout: () => 'Timeout',
})
);
await pipe(
Effect.cachedWithTTL(causeTimeout, '1 minute'),
Effect.andThen(run => run),
Effect.runPromiseExit,
promiseExit => Promise.race([
promiseExit,
new Promise((resolve) => setTimeout(() => resolve('Timeout waiting for Exit'), 5_000))
]).then(console.log)
);
What is the expected behavior?
A Exit object with failure "Timeout" is printed to the console
What do you see instead?
String "Timeout waiting for Exit" is printed to console
Additional information
It seems like Effect.cachedWithTTL prevents the timeout from being triggered. Interestingly enough, Effect.cached works as expected.
Effect.cachedInvalidateWithTTL also suppresses to trigger the timeout
What version of Effect is running?
3.21.4
What steps can reproduce the bug?
Run the following code:
What is the expected behavior?
A
Exitobject with failure"Timeout"is printed to the consoleWhat do you see instead?
String
"Timeout waiting for Exit"is printed to consoleAdditional information
It seems like
Effect.cachedWithTTLprevents the timeout from being triggered. Interestingly enough,Effect.cachedworks as expected.Effect.cachedInvalidateWithTTLalso suppresses to trigger the timeout