Skip to content

CORDEA/backoff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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