Fix double save when reloading partition map

This commit is contained in:
Calvin Montgomery 2016-08-31 21:33:56 -07:00
parent 8b94c54d25
commit 5b60a48c7f

View file

@ -220,14 +220,20 @@ Server.prototype.getChannel = function (name) {
return c;
};
Server.prototype.unloadChannel = function (chan) {
Server.prototype.unloadChannel = function (chan, options) {
if (chan.dead) {
return;
}
if (!options) {
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.close();
@ -359,7 +365,7 @@ Server.prototype.reloadPartitionMap = function () {
} catch (error) {
}
});
this.unloadChannel(channel);
this.unloadChannel(channel, { skipSave: true });
}).catch(error => {
Logger.errlog.log(`Failed to unload /r/${channel.name} for ` +
`partition map flip: ${error.stack}`);