Skip to content

Commit

Permalink
fix(1961): Retry with new request package (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyi authored Sep 14, 2021
1 parent b81583f commit 7119078
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const RETRY_DELAY = 5;
class ExecutorQueue extends Executor {
constructor(config = {}) {
super();
this.requestRetryStrategy = (response, retryWithMergedOptions) => {
this.requestRetryStrategy = response => {
if (response.statusCode !== 201 && response.statusCode !== 200) {
retryWithMergedOptions({});
throw new Error('Retry limit reached');
}

return response;
Expand Down Expand Up @@ -220,7 +220,7 @@ class ExecutorQueue extends Executor {
'Content-Type': 'application/json'
},
url: `${this.queueUri}${args.path}`,
retryOptions: {
retry: {
limit: RETRY_LIMIT,
calculateDelay: ({ computedValue }) => (computedValue ? RETRY_DELAY * 1000 : 0) // in ms
},
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('index test', () => {
'Content-Type': 'application/json'
},
body: testConfig,
retryOptions: {
retry: {
limit: 3,
calculateDelay: ({ computedValue }) => (computedValue ? 5000 : 0)
},
Expand Down

0 comments on commit 7119078

Please sign in to comment.