mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Fix incorrect handling of 0 ids
Fix tests of slave and instance ids that incorrectly return the wrong result when the id is 0.
This commit is contained in:
1 parent
5ad89f072f
commit
3d186a24ff
3 files changed
+5
-5
No files matched your search
@@ -58,11 +58,11 @@ class WebConsoleFormat {
|
||||
|
||||
transform(info, options) {
|
||||
let src = " ";
|
||||
if (info.slave_id) {
|
||||
if (info.slave_id !== undefined) {
|
||||
let slaveName = info.slave_id;
|
||||
src += `s:${slaveName} - `;
|
||||
}
|
||||
if (info.instance_id) {
|
||||
if (info.instance_id !== undefined) {
|
||||
let instanceName = info.instance_id;
|
||||
src += `i:${instanceName}`;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ class ControlConnection extends BaseConnection {
|
||||
|
||||
async updateInstanceConfig(instance) {
|
||||
let slaveId = instance.config.get("instance.assigned_slave");
|
||||
if (slaveId) {
|
||||
if (slaveId !== null) {
|
||||
let connection = this._master.wsServer.slaveConnections.get(slaveId);
|
||||
if (connection) {
|
||||
await libLink.messages.assignInstance.send(connection, {
|
||||
|
||||
@@ -34,10 +34,10 @@ function logFilter({ all, master, slave_ids, instance_ids }, info) {
|
||||
if (master && info.slave_id === undefined) {
|
||||
return true;
|
||||
}
|
||||
if (info.slave_id && slave_ids.includes(info.slave_id)) {
|
||||
if (info.slave_id !== undefined && slave_ids.includes(info.slave_id)) {
|
||||
return true;
|
||||
}
|
||||
if (info.instance_id && instance_ids.includes(info.instance_id)) {
|
||||
if (info.instance_id !== undefined && instance_ids.includes(info.instance_id)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user