connor4312 / cockatiel

🐦 A resilience and fault-handling library. Supports Backoffs, Retries, Circuit Breakers, Timeouts, Bulkhead Isolation, and Fallbacks.
MIT License
1.59k stars 50 forks source link

Docs: Randomised backoff #5

Closed chrismilleruk closed 4 years ago

chrismilleruk commented 4 years ago

This looks like an awesome library 👏

The docs didn’t convince me that you had randomised the exponential backoff so I had to go searching in the source.

As it happens, you have decorrelated jitter by default on the exponential backoff strategy which is a fantastic approach.

It might be worth surfacing this earlier in the docs where you first introduce exponential and also call it out explicitly within the exponential backoff examples section.

i.e. here:

// Create a retry policy that'll try whatever function we execute 3
// times with an exponential backoff (+jitter)

...and here: https://github.com/connor4312/cockatiel/blob/master/readme.md#exponentialbackoff

// Have some lower limits:
const limitedBackoff = new ExponentialBackoff({ maxDelay: 1000, initialDelay: 4 });

// Use a different jitter generator
...
connor4312 commented 4 years ago

Thanks for the suggestion! Done in f51b288