mirror of https://github.com/calzoneman/sync.git
Fix double save when reloading partition map
This commit is contained in:
parent
8b94c54d25
commit
5b60a48c7f
|
@ -220,14 +220,20 @@ Server.prototype.getChannel = function (name) {
|
||||||
return c;
|
return c;
|
||||||
};
|
};
|
||||||
|
|
||||||
Server.prototype.unloadChannel = function (chan) {
|
Server.prototype.unloadChannel = function (chan, options) {
|
||||||
if (chan.dead) {
|
if (chan.dead) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
chan.saveState().catch(error => {
|
if (!options) {
|
||||||
Logger.errlog.log(`Failed to save /r/${chan.name} for unload: ${error.stack}`);
|
options = {};
|
||||||
});
|
}
|
||||||
|
|
||||||
|
if (!options.skipSave) {
|
||||||
|
chan.saveState().catch(error => {
|
||||||
|
Logger.errlog.log(`Failed to save /r/${chan.name} for unload: ${error.stack}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
chan.logger.log("[init] Channel shutting down");
|
chan.logger.log("[init] Channel shutting down");
|
||||||
chan.logger.close();
|
chan.logger.close();
|
||||||
|
@ -359,7 +365,7 @@ Server.prototype.reloadPartitionMap = function () {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.unloadChannel(channel);
|
this.unloadChannel(channel, { skipSave: true });
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
Logger.errlog.log(`Failed to unload /r/${channel.name} for ` +
|
Logger.errlog.log(`Failed to unload /r/${channel.name} for ` +
|
||||||
`partition map flip: ${error.stack}`);
|
`partition map flip: ${error.stack}`);
|
||||||
|
|
Loading…
Reference in New Issue