Remove catch from cron (#8963)

* Removed extra logging

* Removed second extra logger

* Removed extra import
This commit is contained in:
Keith Holliday 2017-08-17 13:42:41 -06:00 committed by GitHub
parent 1a99380a53
commit 4929a2dd79

View file

@ -5,7 +5,6 @@ import { model as Group } from '../models/group';
import { model as User } from '../models/user';
import { recoverCron, cron } from '../libs/cron';
import { v4 as uuid } from 'uuid';
import logger from '../libs/logger';
async function checkForActiveCron (user, now) {
let _cronSignature = uuid();
@ -120,17 +119,13 @@ async function cronAsync (req, res) {
await recoverCron(recoveryStatus, res.locals);
} else {
logger.error(err, {isUserUpdateErroringDuringCron: true});
// For any other error make sure to reset _cronSignature so that it doesn't prevent cron from running
// at the next request
await User.update({
_id: user._id,
}, {
_cronSignature: 'NOT_RUNNING',
}).exec()
.catch((newError) => {
logger.error(newError, {isUserUpdateErroringDuringCron: true});
});
}).exec();
throw err; // re-throw the original error
}