






















@@ -716,6 +716,45 @@ describe("TelegramPollingSession", () => {
716716});
717717});
718718719+it("recovers unowned processing claims after the initial drain", async () => {
720+await withTempSpool(async (tempDir) => {
721+const abort = new AbortController();
722+const events: string[] = [];
723+await writeSpooledTestUpdates(tempDir, [topicUpdate(40, 11, "warmup topic 11 turn")]);
724+725+const { runPromise, stopWorker } = startIsolatedIngressSession({
726+ abort,
727+spoolDir: tempDir,
728+handleUpdate: async (update) => {
729+events.push(`handled:${update.update_id}`);
730+if (update.update_id === 42) {
731+abort.abort();
732+}
733+},
734+});
735+736+await vi.waitFor(() => expect(events).toEqual(["handled:40"]));
737+await vi.waitFor(async () => expect(await pendingUpdateIds(tempDir)).toEqual([]));
738+739+await writeSpooledTestUpdates(tempDir, [
740+topicUpdate(42, 10, "interrupted topic 10 turn"),
741+topicUpdate(43, 10, "later topic 10 turn"),
742+]);
743+const interrupted = (await listTelegramSpooledUpdates({ spoolDir: tempDir })).find(
744+(update) => update.updateId === 42,
745+);
746+if (!interrupted) {
747+throw new Error("Expected interrupted update");
748+}
749+await claimTelegramSpooledUpdate(interrupted);
750+751+await runPromise;
752+expect(events).toEqual(["handled:40", "handled:42"]);
753+expect(await pendingUpdateIds(tempDir)).toEqual([43]);
754+stopWorker();
755+});
756+});
757+719758it("scans past active-lane backlogs to start unrelated lanes", async () => {
720759await withTempSpool(async (tempDir) => {
721760const abort = new AbortController();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。