No description
Find a file
2022-02-06 12:51:33 +09:00
.github/workflows add a trigger 2022-02-06 12:48:20 +09:00
examples restructure 2018-11-18 14:41:38 +09:00
src restructure 2018-11-18 14:41:38 +09:00
test/backoff restructure 2018-11-18 14:41:38 +09:00
.gitignore Initial commit 2018-11-17 20:40:30 +09:00
backoff.nimble define new task 2022-02-06 12:21:52 +09:00
LICENSE Initial commit 2018-11-17 20:40:30 +09:00
README.md replace the badge 2022-02-06 12:40:10 +09:00

Build Status

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()