Skip to content

Commit

Permalink
refactor code for limiting exponential backoff
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanmar511 committed Nov 27, 2017
1 parent f526273 commit 2cb3f94
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ts/src/profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ export class Retryer {
}
getBackoff(): number {
const curBackoff = Math.random() * this.nextBackoffMillis;
this.nextBackoffMillis = this.backoffMultiplier * this.nextBackoffMillis;
if (this.nextBackoffMillis > this.maxBackoffMillis) {
this.nextBackoffMillis = this.maxBackoffMillis;
}
this.nextBackoffMillis = Math.min(
this.backoffMultiplier * this.nextBackoffMillis, this.maxBackoffMillis);
return curBackoff;
}
reset() {
Expand Down

0 comments on commit 2cb3f94

Please # to comment.