Home

Awesome

Build Status

backoff

Implementation of exponential backoff for nim.

Jitter

Support three jitter algorithms.

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