redis: Check the new dump location first

we do not cleanup the old dumps (yet). this then means that we will
constantly be importing the older dump.
This commit is contained in:
Girish Ramakrishnan
2018-10-17 10:33:39 -07:00
parent 4ab2f8c153
commit 78936a35c5

View File

@@ -1372,11 +1372,11 @@ function restoreRedis(app, options, callback) {
if (error) return callback(error);
let input;
let oldDumpLocation = path.join(paths.APPS_DATA_DIR, app.id, 'redis/dump.rdb');
if (fs.existsSync(oldDumpLocation)) {
input = fs.createReadStream(oldDumpLocation);
} else {
input = fs.createReadStream(path.join(paths.APPS_DATA_DIR, app.id, 'dump.rdb'));
const newDumpLocation = path.join(paths.APPS_DATA_DIR, app.id, 'dump.rdb');
if (fs.existsSync(newDumpLocation)) {
input = fs.createReadStream(newDumpLocation);
} else { // old location of dumps
input = fs.createReadStream(path.join(paths.APPS_DATA_DIR, app.id, 'redis/dump.rdb'));
}
input.on('error', callback);