Converting backoff.js to TypeScript#328
Conversation
fda61ce to
bb62f9c
Compare
Codecov Report
@@ Coverage Diff @@
## master #328 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 10 9 -1
Lines 1881 1838 -43
Branches 382 370 -12
=====================================
- Hits 1881 1838 -43Continue to review full report at Codecov.
|
bb62f9c to
f8658a8
Compare
f8658a8 to
93deb66
Compare
|
Sending this off for review. The Windows CI seems to be broken: [11:01:04][ERROR] Failed to get build config |
hiranya911
left a comment
There was a problem hiding this comment.
Looks pretty good. Just a few minor things to adjust.
| } | ||
|
|
||
| /** | ||
| * Configuration object to adjust the delays of the exponential backoff |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| private currentBaseMs = 0; | ||
|
|
||
| constructor(options: ExponentialBackoffOptions = {}) { | ||
| this.initialDelayMs = options.initialDelayMs !== undefined ? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| */ | ||
| _jitterDelayMs() { | ||
| return (Math.random() - 0.5) * this._jitterFactor * this._currentBaseMs; | ||
| private jitterDelayMs() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (this._currentBaseMs < this._initialDelayMs) { | ||
| this._currentBaseMs = this._initialDelayMs; | ||
| this.currentBaseMs *= this.backoffFactor; | ||
| if (this.currentBaseMs < this.initialDelayMs) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (this._currentBaseMs > this._maxDelayMs) { | ||
| this._currentBaseMs = this._maxDelayMs; | ||
| if (this.currentBaseMs > this.maxDelayMs) { | ||
| this.currentBaseMs = this.maxDelayMs; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
schmidt-sebastian
left a comment
There was a problem hiding this comment.
Thanks for you review.
| } | ||
|
|
||
| /** | ||
| * Configuration object to adjust the delays of the exponential backoff |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| private currentBaseMs = 0; | ||
|
|
||
| constructor(options: ExponentialBackoffOptions = {}) { | ||
| this.initialDelayMs = options.initialDelayMs !== undefined ? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (this._currentBaseMs < this._initialDelayMs) { | ||
| this._currentBaseMs = this._initialDelayMs; | ||
| this.currentBaseMs *= this.backoffFactor; | ||
| if (this.currentBaseMs < this.initialDelayMs) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if (this._currentBaseMs > this._maxDelayMs) { | ||
| this._currentBaseMs = this._maxDelayMs; | ||
| if (this.currentBaseMs > this.maxDelayMs) { | ||
| this.currentBaseMs = this.maxDelayMs; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| */ | ||
| _jitterDelayMs() { | ||
| return (Math.random() - 0.5) * this._jitterFactor * this._currentBaseMs; | ||
| private jitterDelayMs() { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #328 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 10 9 -1
Lines 1881 1838 -43
Branches 382 370 -12
=====================================
- Hits 1881 1838 -43Continue to review full report at Codecov.
|
No description provided.