Created
June 18, 2015 00:52
-
-
Save aackerman/570d56149f9e41ffffe5 to your computer and use it in GitHub Desktop.
Exponential backoff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const MAX_TIME = 30000; | |
| export default (iteration, maxTime = MAX_TIME) => { | |
| let time = Math.pow(2, iteration - 1) * 1000; | |
| if (time > maxTime) { time = maxTime; } | |
| return time; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment