Comparing version 2.2.0 to 2.3.0
@@ -6,2 +6,9 @@ Next | ||
2.3.0 / 2019-12-16 | ||
================== | ||
* Improved performance in situations when there are many "expired" jobs in the database ([#869](https://github.com/agenda/agenda/pull/869)) (Thanks @mfred488!) | ||
* Fix periodic node.js process unhandledRejection ([#887](https://github.com/agenda/agenda/pull/887)) (Thanks @koresar and @Scorpil) | ||
* Update dependencies | ||
2.2.0 / 2019-11-24 | ||
@@ -8,0 +15,0 @@ ================== |
@@ -39,19 +39,15 @@ 'use strict'; | ||
// * Query used to find job to run | ||
// * @type {{$or: [*]}} | ||
// * @type {{$and: [*]}} | ||
// */ | ||
const JOB_PROCESS_WHERE_QUERY = { | ||
$or: [{ | ||
$and: [{ | ||
name: jobName, | ||
lockedAt: null, | ||
nextRunAt: {$lte: this._nextScanAt}, | ||
disabled: {$ne: true} | ||
}, { | ||
name: jobName, | ||
lockedAt: {$exists: false}, | ||
nextRunAt: {$lte: this._nextScanAt}, | ||
disabled: {$ne: true} | ||
}, { | ||
name: jobName, | ||
lockedAt: {$lte: lockDeadline}, | ||
disabled: {$ne: true} | ||
$or: [{ | ||
lockedAt: {$eq: null}, | ||
nextRunAt: {$lte: this._nextScanAt} | ||
}, { | ||
lockedAt: {$lte: lockDeadline} | ||
}] | ||
}] | ||
@@ -58,0 +54,0 @@ }; |
@@ -46,3 +46,3 @@ 'use strict'; | ||
this.attrs.nextRunAt = nextDate; | ||
debug('[%s:%s] nextRunAt set to [%s]', this.attrs.name, this.attrs._id, this.attrs.nextRunAt.toISOString()); | ||
debug('[%s:%s] nextRunAt set to [%s]', this.attrs.name, this.attrs._id, new Date(this.attrs.nextRunAt).toISOString()); | ||
// Either `xo` linter or Node.js 8 stumble on this line if it isn't just ignored | ||
@@ -54,6 +54,6 @@ } catch (error) { // eslint-disable-line no-unused-vars | ||
this.attrs.nextRunAt = lastRun.valueOf(); | ||
debug('[%s:%s] nextRunAt set to [%s]', this.attrs.name, this.attrs._id, this.attrs.nextRunAt.toISOString()); | ||
debug('[%s:%s] nextRunAt set to [%s]', this.attrs.name, this.attrs._id, new Date(this.attrs.nextRunAt).toISOString()); | ||
} else { | ||
this.attrs.nextRunAt = lastRun.valueOf() + humanInterval(interval); | ||
debug('[%s:%s] nextRunAt set to [%s]', this.attrs.name, this.attrs._id, this.attrs.nextRunAt.toISOString()); | ||
debug('[%s:%s] nextRunAt set to [%s]', this.attrs.name, this.attrs._id, new Date(this.attrs.nextRunAt).toISOString()); | ||
} | ||
@@ -60,0 +60,0 @@ // Either `xo` linter or Node.js 8 stumble on this line if it isn't just ignored |
@@ -212,3 +212,3 @@ 'use strict'; | ||
// Otherwise, setTimeout that gets called at the time of 'nextRunAt' | ||
if (job.attrs.nextRunAt < now) { | ||
if (job.attrs.nextRunAt <= now) { | ||
debug('[%s:%s] nextRunAt is in the past, run the job immediately', job.attrs.name, job.attrs._id); | ||
@@ -219,3 +219,3 @@ runOrRetry(); | ||
debug('[%s:%s] nextRunAt is in the future, calling setTimeout(%d)', job.attrs.name, job.attrs._id, runIn); | ||
setTimeout(runOrRetry, runIn); | ||
setTimeout(jobProcessing, runIn); | ||
} | ||
@@ -256,5 +256,2 @@ | ||
.then(job => processJobResult(...Array.isArray(job) ? job : [null, job])); // eslint-disable-line promise/prefer-await-to-then | ||
// Re-run the loop to check for more jobs to process (locally) | ||
jobProcessing(); | ||
} else { | ||
@@ -261,0 +258,0 @@ // Run the job immediately by putting it on the top of the queue |
{ | ||
"name": "agenda", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Light weight job scheduler for Node.js", | ||
@@ -19,7 +19,9 @@ "main": "index.js", | ||
"mocha-debug-all": "DEBUG=agenda:** mocha --reporter spec --timeout 8000 -b", | ||
"docs": "jsdoc --configure .jsdoc.json --verbose" | ||
}, | ||
"config": { | ||
"blanket": { | ||
"pattern": "lib", | ||
"data-cover-never": "node_modules" | ||
}, | ||
"docs": "jsdoc --configure .jsdoc.json --verbose" | ||
} | ||
}, | ||
@@ -48,10 +50,16 @@ "repository": { | ||
"human-interval": "~1.0.0", | ||
"moment-timezone": "~0.5.26", | ||
"mongodb": "~3.3.0" | ||
"moment-timezone": "~0.5.27", | ||
"mongodb": "~3.4.0" | ||
}, | ||
"devDependencies": { | ||
"blanket": "1.2.3", | ||
"coveralls": "3.0.8", | ||
"coveralls": "3.0.9", | ||
"delay": "4.3.0", | ||
"eslint": "6.7.0", | ||
"eslint-config-xo": "0.27.2", | ||
"eslint-plugin-ava": "9.0.0", | ||
"eslint-plugin-eslint-comments": "3.1.2", | ||
"eslint-plugin-import": "2.19.1", | ||
"eslint-plugin-node": "10.0.0", | ||
"eslint-plugin-unicorn": "14.0.1", | ||
"eslint": "6.7.2", | ||
"expect.js": "0.3.1", | ||
@@ -68,2 +76,5 @@ "jsdoc": "3.6.3", | ||
"space": 2, | ||
"ignores": [ | ||
"docs/**" | ||
], | ||
"rules": { | ||
@@ -70,0 +81,0 @@ "space-before-function-paren": [ |
<p align="center"> | ||
<img src="https://cdn.rawgit.com/agenda/agenda/master/agenda.svg" alt="Agenda" width="100" height="100"> | ||
<img src="https://cdn.jsdelivr.net/gh/agenda/agenda@master/agenda.svg" alt="Agenda" width="100" height="100"> | ||
</p> | ||
@@ -4,0 +4,0 @@ <p align="center"> |
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
109524
18
1588
+ Addedmongodb@3.4.1(transitive)
- Removedmongodb@3.3.5(transitive)
Updatedmoment-timezone@~0.5.27
Updatedmongodb@~3.4.0