pg-scheduler
Advanced tools
Comparing version 4.0.0-beta2 to 4.0.0-beta3
@@ -13,2 +13,3 @@ /// <reference types="node" /> | ||
getTasksIds(): number[]; | ||
readonly length: number; | ||
} |
@@ -45,3 +45,6 @@ "use strict"; | ||
} | ||
get length() { | ||
return this.queue.length; | ||
} | ||
} | ||
exports.Queue = Queue; |
@@ -30,2 +30,3 @@ /// <reference types="sequelize" /> | ||
errorHandler: (err: Error) => void; | ||
maxQueueCapacity: number; | ||
} | ||
@@ -32,0 +33,0 @@ export interface TaskOptions { |
@@ -26,2 +26,3 @@ "use strict"; | ||
maxConcurrency: 20, | ||
maxQueueCapacity: 50, | ||
}; | ||
@@ -159,2 +160,10 @@ class Scheduler { | ||
clearTimeout(this.pollingTimeout); | ||
if (this.stopping) { | ||
return; | ||
} | ||
if (this.queue.length + this.noProcessors.length > this.options.maxQueueCapacity) { | ||
debug(`${process.pid} maxQueueCapacity overflow: ${this.queue.length} + ${this.noProcessors.length} > ${this.options.maxQueueCapacity}`); | ||
this.pollingRepeat(); | ||
return; | ||
} | ||
const currDate = new Date(), defaultWhere = { | ||
@@ -328,2 +337,3 @@ nextRunAt: { $lte: currDate }, | ||
console.error('processor completes with error', err); | ||
// TODO: make optional saving error to "TasksErrors" table | ||
task.failsCount++; | ||
@@ -330,0 +340,0 @@ } |
{ | ||
"name": "pg-scheduler", | ||
"version": "4.0.0-beta2", | ||
"version": "4.0.0-beta3", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "NODE_ENV=testing mocha test/**/*.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35651
901