Add exponential backoff of login attempts.

This commit is contained in:
Jake Moshenko 2014-09-02 15:27:05 -04:00
parent 066b3ed8f0
commit 2dcdd7ba5b
5 changed files with 46 additions and 1 deletions

5
util/backoff.py Normal file
View file

@ -0,0 +1,5 @@
def exponential_backoff(attempts, scaling_factor, base):
backoff = 5 * (pow(2, attempts) - 1)
backoff_time = backoff * scaling_factor
retry_at = backoff_time/10 + base
return retry_at