Skip to content

Instantly share code, notes, and snippets.

@imRohan
Created April 13, 2017 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imRohan/6ad6fd6107666a437e9a4e6eb7266b30 to your computer and use it in GitHub Desktop.
Save imRohan/6ad6fd6107666a437e9a4e6eb7266b30 to your computer and use it in GitHub Desktop.
Exponential Backoff Algo
/* 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