From eb1ff541b7d7d1d9734e3699c9c27556d5206b33 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sat, 7 Nov 2026 12:51:43 +0900 Subject: [PATCH] Use controller.hosts.records for the host datastore (#59) clusterio #1180 made controller.hosts a HostManager. The datastore with set and the update event now lives on controller.hosts.records. Co-authored-by: bbassie <17990055+bbassie@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- exp_auto_restart/test/controller.test.js | 2 +- exp_server_list/controller.ts | 2 +- exp_server_list/test/controller.test.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exp_auto_restart/test/controller.test.js b/exp_auto_restart/test/controller.test.js index c2eb13da..0e528ac0 100644 --- a/exp_auto_restart/test/controller.test.js +++ b/exp_auto_restart/test/controller.test.js @@ -41,7 +41,7 @@ async function startPlugin(t2, { config = {}, canRestart = false } = {}) { } function addHost(controller, id, connected = true) { - controller.hosts.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), connected)); + controller.hosts.records.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), connected)); } function addInstance(controller, id, hostId, status = "running", fields = {}) { diff --git a/exp_server_list/controller.ts b/exp_server_list/controller.ts index 7a105b54..dc44d57d 100644 --- a/exp_server_list/controller.ts +++ b/exp_server_list/controller.ts @@ -114,7 +114,7 @@ export default async function (context: ControllerPluginContext) { }); // The public address of a host arrives after it connects - controller.hosts.on("update", hosts => { + controller.hosts.records.on("update", hosts => { const hostIds = new Set(hosts.map(host => host.id)); refresh([...controller.instances.values()].filter(instance => { const hostId = instance.config.get("instance.assigned_host"); diff --git a/exp_server_list/test/controller.test.js b/exp_server_list/test/controller.test.js index 11a8e853..4dafe170 100644 --- a/exp_server_list/test/controller.test.js +++ b/exp_server_list/test/controller.test.js @@ -47,7 +47,7 @@ async function startPlugin(t2, setup = () => {}) { } function addHost(controller, id, publicAddress = "") { - controller.hosts.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), true, "", publicAddress)); + controller.hosts.records.set(new HostRecord(id, `host-${id}`, "2.0.0", new Map(), true, "", publicAddress)); } function addInstance(controller, id, { hostId = 1, status = "running", gamePort, factorioVersion, fields = {} } = {}) {