Skip to content

Commit

Permalink
Adjust error messages and add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Lush committed Aug 8, 2017
1 parent 34a5692 commit 906a089
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,13 @@ Agenda.prototype._findAndLockNextJob = function(jobName, definition, cb) {
if (s.topology.connections().length === 0) {
if (s.topology.autoReconnect && !s.topology.isDestroyed()) {
// continue processing but notify that Agenda has lost the connection
self.emit('error', new Error('No MongoDB connection'));
debug('Missing MongoDB connection, not attempting to find and lock a job');
self.emit('error', new Error('Lost MongoDB connection'));
cb();
} else {
// no longer recoverable
cb(new Error('MongoDB topology has been destroyed'));
debug('topology.autoReconnect: %s, topology.isDestroyed(): %s', s.topology.autoReconnect, s.topology.isDestroyed());
cb(new Error('MongoDB connection is not recoverable, application restart required'));
}
} else {
/**
Expand Down

0 comments on commit 906a089

Please sign in to comment.