Repository: taskforcesh/bullmq
Pull request #219 (2020-06-04 07:17:57)

Remove AdvancedOptions except backoffStrategies
Related to #218 

Changes:
* Remove visibilityWindow from WorkerOptions
* Remove everything from AdvancedOptions except backoffStrategies:
  * stalledInterval
  * maxStalledCount
  * guardInterval
  * retryProcessDelay
  * drainDelay (drainDelay still exists in WorkerOptions)

Note: backoffStratgies is missing a type.

manast: looks great thanks. For the next time please use conventional commit format for commits, I can fix it now squashing so no big issue.

Patch:
diff --git a/src/interfaces/advanced-options.ts b/src/interfaces/advanced-options.ts
index 719806c759..1e832e9fab 100644
--- a/src/interfaces/advanced-options.ts
+++ b/src/interfaces/advanced-options.ts
@@ -1,28 +1,8 @@
 export interface AdvancedOptions {
-  // How often check for stalled jobs (use 0 for never checking).
-  stalledInterval?: number;
-
-  // Max amount of times a stalled job will be re-processed.
-  maxStalledCount?: number;
-
-  // Poll interval for delayed jobs and added jobs.
-  guardInterval?: number;
-
-  // delay before processing next job in case of internal error.
-  retryProcessDelay?: number;
-
   // A set of custom backoff strategies keyed by name.
   backoffStrategies?: {};
-
-  // A timeout for when the queue is in drained state (empty waiting for jobs).
-  drainDelay?: number;
 }
 
 export const AdvancedOptionsDefaults: AdvancedOptions = {
-  stalledInterval: 30000,
-  maxStalledCount: 1,
-  guardInterval: 5000,
-  retryProcessDelay: 5000,
   backoffStrategies: {},
-  drainDelay: 5,
 };
diff --git a/src/interfaces/worker-options.ts b/src/interfaces/worker-options.ts
index 66280bd856..1e2fa6bb67 100644
--- a/src/interfaces/worker-options.ts
+++ b/src/interfaces/worker-options.ts
@@ -10,6 +10,5 @@ export interface WorkerOptions extends QueueBaseOptions {
   drainDelay?: number;
   lockDuration?: number;
   lockRenewTime?: number;
-  visibilityWindow?: number; // seconds // FIXME not used?
-  settings?: AdvancedOptions; // FIXME not used?
+  settings?: AdvancedOptions; // FIXME only backoffStrategies is used
 }


Test patch:
diff --git a/src/test/test_sandboxed_process.ts b/src/test/test_sandboxed_process.ts
index 48ca31c32f..bf741f69f5 100644
--- a/src/test/test_sandboxed_process.ts
+++ b/src/test/test_sandboxed_process.ts
@@ -30,10 +30,6 @@ describe('sandboxed process', () => {
 
     const worker = new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const completting = new Promise((resolve, reject) => {
@@ -63,10 +59,6 @@ describe('sandboxed process', () => {
     const processFile = __dirname + '/fixtures/fixture_processor.js';
     const worker = new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const completting = new Promise((resolve, reject) => {
@@ -106,10 +98,6 @@ describe('sandboxed process', () => {
     worker = new Worker(queueName, processFile, {
       concurrency: 4,
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const completing = new Promise((resolve, reject) => {
@@ -145,10 +133,6 @@ describe('sandboxed process', () => {
     worker = new Worker(queueName, processFile, {
       concurrency: 1,
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     await Promise.all([
@@ -188,10 +172,6 @@ describe('sandboxed process', () => {
 
     const worker = new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const progresses: any[] = [];
@@ -232,10 +212,6 @@ describe('sandboxed process', () => {
 
     const worker = new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const failing = new Promise((resolve, reject) => {
@@ -285,10 +261,6 @@ describe('sandboxed process', () => {
 
     const worker = new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const job = await queue.add('test', {});
@@ -304,10 +276,6 @@ describe('sandboxed process', () => {
 
     new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const job = await queue.add('test', { exitCode: 0 });
@@ -325,10 +293,6 @@ describe('sandboxed process', () => {
 
     new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const job = await queue.add('test', { exitCode: 1 });
@@ -346,10 +310,6 @@ describe('sandboxed process', () => {
 
     const worker = new Worker(queueName, processFile, {
       drainDelay: 1,
-      settings: {
-        guardInterval: 300000,
-        stalledInterval: 300000,
-      },
     });
 
     const completting = new Promise((resolve, reject) => {