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;
|
||||
};
|
||||
|
||||
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}`);
|
||||
|
|
Loading…
Reference in a new issue