Effect CommunityEC
Effect Community3y ago
12 replies
Stephen Bluck

Limiting Retries with `Schedule.spaced`

When using Schedule.spaced, is it possible to limit the amount of retries? I have the following schedule which is used within a Effect.repeat(schedule).
const schedule = pipe(
  Schedule.spaced(Duration.millis(750)),
  Schedule.tapOutput((n) => Effect.logDebug(`Attempt ${n + 1}`))
);

There is an Effect.retryN but I don't think that's what I'm after. It felt natural to use Schedule.recurs(5) within my schedule but I don't think it plays well with spaced.
Was this page helpful?