diff --git a/index.js b/index.js index 6eefa43..cb91a97 100644 --- a/index.js +++ b/index.js @@ -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; @@ -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 }, diff --git a/test/index.test.js b/test/index.test.js index 3dd006d..183db5c 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -49,7 +49,7 @@ describe('index test', () => { 'Content-Type': 'application/json' }, body: testConfig, - retryOptions: { + retry: { limit: 3, calculateDelay: ({ computedValue }) => (computedValue ? 5000 : 0) },