Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

do not throw errors, as mongodb client would auto-reconnect by default #1

Closed
wants to merge 2 commits into from

Conversation

lk9100
Copy link
Member

@lk9100 lk9100 commented Feb 7, 2017

No description provided.

kai@home added 2 commits February 7, 2017 21:06
…t. also remove the bit for handling PC resuming from sleep hardly any practical value with it
@lk9100 lk9100 self-assigned this Feb 7, 2017
@lk9100 lk9100 requested a review from halfninja February 7, 2017 22:07
@halfninja
Copy link
Member

Need to recreate this PR as a merge into the upstream project

@halfninja halfninja closed this Feb 8, 2017
@@ -607,7 +600,7 @@ function processJobs(extraJob) {
self._nextScanAt = new Date(now.valueOf() + self._processEvery);
self._findAndLockNextJob(name, definitions[name], function(err, job) {
if (err) {
throw err;
console.log('error with mongodb connection', err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Console.log probably isn't appropriate, and we don't know at this point that it's definitely a mongo error.. could have been passed any error

var s = this._mdb.s || this._mdb.db.s;
if (s.topology.connections().length === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we had trouble with the scheduler restarting when we took this away. It seemed to work best when we just stopped throwing the error, though I don't know why

Copy link
Member Author

@lk9100 lk9100 Feb 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok will keep this bit..

@@ -420,33 +420,26 @@ Agenda.prototype._findAndLockNextJob = function(jobName, definition, cb) {
var self = this,
now = new Date(),
lockDeadline = new Date(Date.now().valueOf() - definition.lockLifetime);

// Don't try and access Mongo Db if we've lost connection to it. Also see clibu_automation.js db.on.close code. NF 29/04/2015
// Trying to resolve crash on Dev PC when it resumes from sleep.
var s = this._mdb.s || this._mdb.db.s;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't need this line

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants