Skip to content

Commit

Permalink
fix(*): run autoupdate in serial to avoid conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Stone <[email protected]>
  • Loading branch information
Simon Stone authored and achrinza committed May 20, 2022
1 parent 06b7239 commit 8f3ae3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,8 @@ MongoDB.prototype.autoupdate = function(models, cb) {

const enableGeoIndexing = this.settings.enableGeoIndexing === true;

async.each(
// Make it serial as multiple models might map to the same collection
async.eachSeries(
models,
function(modelName, modelCallback) {
const indexes = self._models[modelName].settings.indexes || [];
Expand Down Expand Up @@ -1954,7 +1955,8 @@ MongoDB.prototype.autoupdate = function(models, cb) {
debug('create indexes: ', indexList);
}

async.each(
// Make it serial as multiple indexes may try to create the same collection at once
async.eachSeries(
indexList,
function(index, indexCallback) {
if (self.debug) {
Expand Down

0 comments on commit 8f3ae3d

Please sign in to comment.