-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c824b6f
commit 1f22f51
Showing
1 changed file
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
# retry-backoff | ||
|
||
WIP | ||
Retry operations with incremental backoff. | ||
|
||
--- | ||
|
||
There's a default timeout set to 30 seconds. If you'd like to set a different | ||
timeout, you'll need to either pass in options to `useRetryWithBackoff`: | ||
|
||
```ts | ||
import { main } from "effection"; | ||
import { useRetryWithBackoff } from "@effection-contrib/retry-backoff"; | ||
import { myOperation } from "./myOperation"; | ||
|
||
await main(function* () { | ||
yield* useRetryWithBackoff(myOperation, { timeout: 45_000 }); | ||
}); | ||
``` | ||
|
||
Or initialize the context so that the same timeout can be applied to all of your | ||
retry operations: | ||
|
||
```ts | ||
import { main } from "effection"; | ||
import { | ||
initRetryWithBackoff, | ||
useRetryWithBackoff, | ||
} from "@effection-contrib/retry-backoff"; | ||
import { myOperation } from "./myOperation"; | ||
|
||
await main(function* () { | ||
yield* initRetryWithBackoff({ timeout: 45_000 }); | ||
yield* retryWithBackoff(myOperation); | ||
}); | ||
``` |