From 85f4a2884a077943ac87d065f2ee26aa521e851c Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Sat, 27 Dec 2014 12:56:54 +0100 Subject: [PATCH] add some more debugging for cron --- src/controllers/user.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/user.js b/src/controllers/user.js index a7f80bf5f7..b4505d95f8 100644 --- a/src/controllers/user.js +++ b/src/controllers/user.js @@ -268,13 +268,18 @@ api.cron = function(req, res, next) { Group.tavernBoss(user,progress); if (!quest) return user.save(next); + // FOR DEBUGGING, PLEASE IGNORE + var opStatus = null; + // If user is on a quest, roll for boss & player, or handle collections // FIXME this saves user, runs db updates, loads user. Is there a better way to handle this? async.waterfall([ function(cb){ + opStatus = 'saveUser'; user.save(cb); // make sure to save the cron effects }, function(saved, count, cb){ + opStatus = 'runQuest'; var type = quest.boss ? 'boss' : 'collect'; Group[type+'Quest'](user,progress,cb); }, @@ -289,7 +294,8 @@ api.cron = function(req, res, next) { stack: (err.stack || err.message || err), body: req.body, headers: req.header, auth: (req.headers['x-api-user'] + ' | ' + req.headers['x-api-key']), - originalUrl: req.originalUrl + originalUrl: req.originalUrl, + opStatus: opStatus }); res.locals.user = saved; next(err,saved);