Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the linter errors on CI #701

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/agenda/cancel.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const debug = require('debug')('agenda:cancel');
*/
module.exports = function(query) {
debug('attempting to cancel all Agenda jobs', query);
// eslint-disable-next-line promise/prefer-await-to-then
return this._collection.deleteMany(query).then(({result}) => {
debug('%s jobs cancelled', result.n);
return result.n;
Expand Down
4 changes: 2 additions & 2 deletions lib/agenda/save-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const {processJobs} = require('../utils');
/**
* Given a result for findOneAndUpdate() or insert() above, determine whether to process
* the job immediately or to let the processJobs() interval pick it up later
* @param {Error} err error passed in via MongoDB call as to whether modify call failed or passed
* @param {Job} job a job to process
* @param {*} result the data returned from the findOneAndUpdate() call or insertOne() call
* @access private
* @returns {undefined}
* @returns {Job} the job that was passed in
*/
const processDbResult = (job, result) => {
debug('processDbResult() called with success, checking whether to process job immediately or not');
Expand Down
2 changes: 1 addition & 1 deletion lib/agenda/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {processJobs} = require('../utils');
* This method will only resolve if a db has been set up beforehand.
* @name Agenda#start
* @function
* @returns {Promise}
* @returns {Promise} a promise with undefined
*/
module.exports = async function() {
if (this._processInterval) {
Expand Down
1 change: 1 addition & 0 deletions lib/utils/process-jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ module.exports = function(extraJob) {
debug('[%s:%s] processing job', job.attrs.name, job.attrs._id);
job.run()
.catch(err => [err, job])
// eslint-disable-next-line promise/prefer-await-to-then
.then(job => processJobResult(...Array.isArray(job) ? job : [null, job]));

// Re-run the loop to check for more jobs to process (locally)
Expand Down
1 change: 1 addition & 0 deletions test/job.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint promise/prefer-await-to-then: 0 */
/* globals describe, it, beforeEach, afterEach */
'use strict';
const path = require('path');
Expand Down