mirror of
https://github.com/CORDEA/backoff
synced 2026-01-15 01:51:31 +00:00
No description
|
|
||
|---|---|---|
| .github/workflows | ||
| examples | ||
| src | ||
| test/backoff | ||
| .gitignore | ||
| backoff.nimble | ||
| LICENSE | ||
| README.md | ||
backoff
Implementation of exponential backoff for nim.
Jitter
Support three jitter algorithms.
- Full Jitter
- Equal Jitter
- Decorrlated Jitter
And of course, without Jitter. I referred to Exponential Backoff And Jitter - AWS Architecture Blog.
Usage
let
client = ApiClient()
# Full Jitter
waiter = newBackoff(TypeFull, 10, 16000)
while true:
let response = client.request()
if response.code.is2xx:
break
waiter.wait() # or await waiter.waitAsync()