Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Converting backoff.js to TypeScript#328

Merged
schmidt-sebastian merged 7 commits intomasterfrom
convertbackoff
Sep 4, 2018
Merged

Converting backoff.js to TypeScript#328
schmidt-sebastian merged 7 commits intomasterfrom
convertbackoff

Conversation

@schmidt-sebastian
Copy link
Copy Markdown
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 24, 2018
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 24, 2018

Codecov Report

Merging #328 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #328   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10      9    -1     
  Lines        1881   1838   -43     
  Branches      382    370   -12     
=====================================
- Hits         1881   1838   -43

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ca87ec...93deb66. Read the comment docs.

@schmidt-sebastian
Copy link
Copy Markdown
Contributor Author

Sending this off for review. The Windows CI seems to be broken:

https://sponge.corp.google.com/target?id=40934a89-97d2-4694-a6a8-a945f217100a&target=cloud-devrel%2Fclient-libraries%2Fnodejs%2Fgoogleapis%2Fnodejs-firestore%2Fpresubmit%2Fnode8%2Flint&searchFor=

[11:01:04][ERROR] Failed to get build config
com.google.devtools.kokoro.config.ConfigException: Build config /tmp/workspace/workspace/cloud-devrel/client-libraries/nodejs/googleapis/nodejs-firestore/presubmit/node8/lint/src/github/nodejs-firestore/.kokoro/presubmit/node8/lint.cfg does not exist

Copy link
Copy Markdown

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. Just a few minor things to adjust.

Comment thread dev/src/backoff.ts
}

/**
* Configuration object to adjust the delays of the exponential backoff

This comment was marked as spam.

This comment was marked as spam.

Comment thread dev/src/backoff.ts
private currentBaseMs = 0;

constructor(options: ExponentialBackoffOptions = {}) {
this.initialDelayMs = options.initialDelayMs !== undefined ?

This comment was marked as spam.

This comment was marked as spam.

Comment thread dev/src/backoff.ts
*/
_jitterDelayMs() {
return (Math.random() - 0.5) * this._jitterFactor * this._currentBaseMs;
private jitterDelayMs() {

This comment was marked as spam.

This comment was marked as spam.

Comment thread dev/src/backoff.ts Outdated
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.

Comment thread dev/src/backoff.ts Outdated
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.

Copy link
Copy Markdown
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you review.

Comment thread dev/src/backoff.ts
}

/**
* Configuration object to adjust the delays of the exponential backoff

This comment was marked as spam.

Comment thread dev/src/backoff.ts
private currentBaseMs = 0;

constructor(options: ExponentialBackoffOptions = {}) {
this.initialDelayMs = options.initialDelayMs !== undefined ?

This comment was marked as spam.

Comment thread dev/src/backoff.ts Outdated
if (this._currentBaseMs < this._initialDelayMs) {
this._currentBaseMs = this._initialDelayMs;
this.currentBaseMs *= this.backoffFactor;
if (this.currentBaseMs < this.initialDelayMs) {

This comment was marked as spam.

Comment thread dev/src/backoff.ts Outdated
if (this._currentBaseMs > this._maxDelayMs) {
this._currentBaseMs = this._maxDelayMs;
if (this.currentBaseMs > this.maxDelayMs) {
this.currentBaseMs = this.maxDelayMs;

This comment was marked as spam.

Comment thread dev/src/backoff.ts
*/
_jitterDelayMs() {
return (Math.random() - 0.5) * this._jitterFactor * this._currentBaseMs;
private jitterDelayMs() {

This comment was marked as spam.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 31, 2018

Codecov Report

Merging #328 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #328   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10      9    -1     
  Lines        1881   1838   -43     
  Branches      382    370   -12     
=====================================
- Hits         1881   1838   -43

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0973006...833ec1c. Read the comment docs.

Copy link
Copy Markdown

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants