alphasights / sneakers_handlers

Retries with exponential backoff for sneakers
MIT License
33 stars 11 forks source link

Ability to configure backoff function #20

Closed brianstorti closed 8 years ago

brianstorti commented 8 years ago

Add new option in the worker setup, called backoff_function. You can pass any callable object to it (a method, a lambda, a class that implements call, etc.) and it will be called receiving the current attempt number.

The default backoff function, for example, is a lambda like that:

-> (attempt_number) { (attempt_number + 1) ** 2 }