Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 673 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 673 Bytes

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