Skip to content
Permalink
Browse files

DeprecationWarnings: autoReconnect, reconnectTries, reconnectInterval (

…#948)

* fix deprecated reconnect options

* fix linting errors

* Update lib/agenda/database.js

Co-Authored-By: Michiel De Mey <de.mey.michiel@gmail.com>

Co-authored-by: Michiel De Mey <de.mey.michiel@gmail.com>
  • Loading branch information
ekegodigital and MichielDeMey committed Feb 27, 2020
1 parent 47df17e commit c75e46a274cce2f0e6e2547646c1eff2f077df04
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/agenda/database.js
@@ -25,8 +25,13 @@ module.exports = function(url, collection, options, cb) {
url = 'mongodb://' + url;
}

let reconnectOptions = {autoReconnect: true, reconnectTries: Number.MAX_SAFE_INTEGER, reconnectInterval: this._processEvery};
if (options && options.useUnifiedTopology && options.useUnifiedTopology === true) {
reconnectOptions = {};
}

collection = collection || 'agendaJobs';
options = {autoReconnect: true, reconnectTries: Number.MAX_SAFE_INTEGER, reconnectInterval: this._processEvery, useNewUrlParser: true, ...options};
options = {...reconnectOptions, ...options};
MongoClient.connect(url, options, (error, client) => {
if (error) {
debug('error connecting to MongoDB using collection: [%s]', collection);

0 comments on commit c75e46a

Please sign in to comment.
You can’t perform that action at this time.