mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Fix offSlaveUpdate and offSaveListUpdate
Fix unreachable code and use of slice instead splice turning offSlaveUpdate and offSaveListUpdate into no-ops.
This commit is contained in:
1 parent
049ccee94e
commit
9aebeeac02
1 file changed
+6
-6
@@ -133,7 +133,7 @@ export class Control extends libLink.Link {
|
|||||||
throw new Error(`Given handler is not registered for slave ${id}`);
|
throw new Error(`Given handler is not registered for slave ${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
handlers.slice(index, 1);
|
handlers.splice(index, 1);
|
||||||
if (!handlers.length) {
|
if (!handlers.length) {
|
||||||
this.slaveUpdateHandlers.delete(id);
|
this.slaveUpdateHandlers.delete(id);
|
||||||
await this.updateSlaveSubscriptions();
|
await this.updateSlaveSubscriptions();
|
||||||
@@ -242,12 +242,12 @@ export class Control extends libLink.Link {
|
|||||||
let index = handlers.lastIndexOf(handler);
|
let index = handlers.lastIndexOf(handler);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
throw new Error(`Given handler is not registered for instance ${id}`);
|
throw new Error(`Given handler is not registered for instance ${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
handlers.splice(index, 1);
|
handlers.splice(index, 1);
|
||||||
if (!handlers.length) {
|
if (!handlers.length) {
|
||||||
this.saveListUpdateHandlers.delete(id);
|
this.saveListUpdateHandlers.delete(id);
|
||||||
await this.updateSaveListSubscriptions();
|
await this.updateSaveListSubscriptions();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user