backoff

Implementation of exponential backoff for nim


Keywords
exponential-backoff, backoff, nim-lang, nimble
License
Apache-2.0
Install
nimble install backoff

Documentation

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