Fixed trying to read build from RocketChat.Info when it is not available.

pull/2144/head
Marcelo Schmidt 9 years ago
parent ea38860483
commit 8c471cb347
  1. 5
      packages/rocketchat-migrations/migrations.js

@ -302,6 +302,7 @@ Migrations._migrateTo = function(version, rerun) {
function lock() {
const date = new Date();
const dateMinusInterval = moment(date).subtract(self.options.lockExpiration, 'minutes').toDate();
const build = RocketChat.Info ? RocketChat.Info.build.date : date;
// This is atomic. The selector ensures only one caller at a time will see
// the unlocked control, and locking occurs in the same update's modifier.
@ -316,14 +317,14 @@ Migrations._migrateTo = function(version, rerun) {
}
}, {
buildAt: {
$ne: RocketChat.Info.build.date
$ne: build
}
}]
}, {
$set: {
locked: true,
lockedAt: date,
buildAt: RocketChat.Info.build.date
buildAt: build
}
}) === 1;
}

Loading…
Cancel
Save