Effect CommunityEC
Effect Community3y ago
8 replies
bug

Composing Retry Methods retryN retryWhile

good morning good evening and good night to my favorite discord.

how can i compose retryWhile with retryN? like in retry-ts where i can separate the RetryPolicy from the predicate?

i think something like this works? but... i'd rather not :):

effect => {
  const numTries = 3
  let i = 0

  return Effect.retryWhile(
    effect,
    ({ cause }) => ++i < numTries && predicate(cause),
  )
},
Was this page helpful?