mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
Keep a newer queue change over a queue reply it overtook
A QueueEvent arriving in the same socket read as a QueueSyncRequest reply is applied before the reply, which then wrote the older queue over it. Skip the reply when a QueueEvent was applied while it was in flight. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fd39e2a171
commit
b10807b6d6
2 files changed
+19
No files matched your search
@@ -117,6 +117,17 @@ describe("research_sync instance", function() {
|
||||
instance.sendTo = async () => { throw new Error("gone"); };
|
||||
await instance.hooks.controllerConnectionEvent.invoke("connect");
|
||||
});
|
||||
it("should not let the reply overwrite a newer QueueEvent delivered with it", async function() {
|
||||
// As if the reply and the broadcast came in one socket read: the event is handled before the
|
||||
// reply resolves the request's await
|
||||
instance.sendTo = async (dst, message) => {
|
||||
sent.push(message);
|
||||
mock.getHandler(instance, QueueEvent)(new QueueEvent(["new"], null, "B"));
|
||||
return ["old"];
|
||||
};
|
||||
await instance.hooks.controllerConnectionEvent.invoke("connect");
|
||||
assert.equal(lastCommand(), applyCommand({ queue: ["new"], instance: "B" }));
|
||||
});
|
||||
});
|
||||
|
||||
it("should forward queue changes from the game", async function() {
|
||||
|
||||
Reference in new issue
Block a user