Created
April 13, 2017 13:06
-
-
Save imRohan/6ad6fd6107666a437e9a4e6eb7266b30 to your computer and use it in GitHub Desktop.
Exponential Backoff Algo
This file contains 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
/* Returns the next back off interval for POST request */ | |
func nextBackOffTime() time.Duration { | |
collisionNumber := float64(networkStatus.failCount) | |
backoffTime := time.Duration((math.Pow(2, collisionNumber) - 1) / 2) | |
return backoffTime | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment