Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add enableRetries and disableRetries #156

Merged
merged 13 commits into from
Aug 27, 2021
Merged

Conversation

barrett-schonefeld
Copy link
Contributor

@barrett-schonefeld barrett-schonefeld commented Aug 23, 2021

I fixed some type-related issues as well. I successfully resolved a couple of type-related issues (not bugs but improvements to type safety).

Checklist
  • npm test passes (tip: npm run lint-fix can correct most style issues)
  • tests are included
  • documentation is changed or added

Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

I left a bunch of picky comments about potentially changing variable names. Sorry for that, but I think it will help us maintain our own sanity if we're super clear about the two different types of "retry config".

lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/base-service.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
@dpopp07
Copy link
Member

dpopp07 commented Aug 24, 2021

@barrett-schonefeld I sent this info on Slack but wanted to capture it here - the reason behind your is not a function problem is that the RequestWrapper class is mocked in the base service tests. See this block of code.

The code itself looks good, you will just need to update the mock for the tests accordingly. You can re-add your setter as well, you'll just need to do the same thing

Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

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

Looks great! I left a couple comments and I'll wait for tests to approve but the code changes and looking solid 👍

test/unit/base-service.test.js Outdated Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
lib/request-wrapper.ts Show resolved Hide resolved
Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

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

This looks great! I left a few comments on things to check before merging but nothing major

lib/request-wrapper.ts Show resolved Hide resolved
lib/request-wrapper.ts Outdated Show resolved Hide resolved
test/mock-server/retry.test.js Outdated Show resolved Hide resolved
test/mock-server/retry.test.js Outdated Show resolved Hide resolved
test/mock-server/retry.test.js Outdated Show resolved Hide resolved
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

We seem to be getting closer and closer. Need to fix the value of retryDelay inside getRaxConfig(). I'll approve now assuming that's fixed.

lib/request-wrapper.ts Outdated Show resolved Hide resolved
test/mock-server/retry.test.js Outdated Show resolved Hide resolved
@padamstx
Copy link
Member

Rut roh, i see that the build failed with lint errors :(

@padamstx
Copy link
Member

... and I think you have more instances of that mock-related "this isn't a function" type errors :)

Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

Sorry, but I need to rescind my previous approval :) Please update BaseService.configureService() so that it supports the "ENABLE_RETRIES", "MAX_RETRIES" and "RETRY_INTERVAL" external config properties. You can look at BaseService.ConfigureService() in the Go core for a reference.
Also, we'll need to make sure those changes to configureService() are tested.

Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

Getting closer. We need some changes around the support of external config properties and I also requested some additional tests.

lib/base-service.ts Outdated Show resolved Hide resolved
test/unit/base-service.test.js Outdated Show resolved Hide resolved
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@barrett-schonefeld barrett-schonefeld merged commit d6f12e7 into main Aug 27, 2021
@barrett-schonefeld barrett-schonefeld deleted the retry-logic branch August 27, 2021 20:00
ibm-devx-sdk pushed a commit that referenced this pull request Aug 27, 2021
# [2.14.0](v2.13.0...v2.14.0) (2021-08-27)

### Features

* add enableRetries and disableRetries ([#156](#156)) ([d6f12e7](d6f12e7))
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 2.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants