mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 23:20:21 +00:00
Control UI: reconnect on seq gaps
This commit is contained in:
@@ -131,12 +131,17 @@ function createHost() {
|
||||
assistantAgentId: null,
|
||||
serverVersion: null,
|
||||
sessionKey: "main",
|
||||
basePath: "",
|
||||
chatMessage: "",
|
||||
chatMessages: [],
|
||||
chatAttachments: [],
|
||||
chatQueue: [],
|
||||
chatToolMessages: [],
|
||||
chatStreamSegments: [],
|
||||
chatStream: null,
|
||||
chatStreamStartedAt: null,
|
||||
chatRunId: null,
|
||||
chatSending: false,
|
||||
toolStreamById: new Map(),
|
||||
toolStreamOrder: [],
|
||||
toolStreamSyncTimer: null,
|
||||
@@ -195,9 +200,9 @@ describe("connectGateway", () => {
|
||||
expect(host.lastError).toBeNull();
|
||||
|
||||
secondClient.emitGap(20, 24);
|
||||
expect(host.lastError).toBe(
|
||||
"event gap detected (expected seq 20, got 24); refresh recommended",
|
||||
);
|
||||
expect(gatewayClientInstances).toHaveLength(3);
|
||||
expect(secondClient.stop).toHaveBeenCalledTimes(1);
|
||||
expect(host.lastError).toBeNull();
|
||||
});
|
||||
|
||||
it("ignores stale client onEvent callbacks after reconnect", () => {
|
||||
|
||||
@@ -264,8 +264,9 @@ export function connectGateway(host: GatewayHost) {
|
||||
if (host.client !== client) {
|
||||
return;
|
||||
}
|
||||
host.lastError = `event gap detected (expected seq ${expected}, got ${received}); refresh recommended`;
|
||||
host.lastError = `event gap detected (expected seq ${expected}, got ${received}); reconnecting`;
|
||||
host.lastErrorCode = null;
|
||||
connectGateway(host);
|
||||
},
|
||||
});
|
||||
host.client = client;
|
||||
|
||||
Reference in New Issue
Block a user