





















@@ -2582,6 +2582,45 @@ describe("deliverOutboundPayloads", () => {
25822582);
25832583});
258425842585+it("logs a warning when failDelivery rejects on bestEffort partial failure (#83113)", async () => {
2586+queueMocks.failDelivery.mockRejectedValueOnce(new Error("queue storage down"));
2587+2588+await runBestEffortPartialFailureDelivery();
2589+2590+expect(queueMocks.failDelivery).toHaveBeenCalledWith(
2591+"mock-queue-id",
2592+"partial delivery failure (bestEffort)",
2593+);
2594+const warnCall = requireMockCall(logMocks.warn, "warn");
2595+const warnMessage = String(warnCall[0]);
2596+expect(warnMessage).toContain("failed to mark queued delivery");
2597+expect(warnMessage).toContain("mock-queue-id");
2598+expect(warnMessage).toContain("queue storage down");
2599+});
2600+2601+it("logs a warning when failDelivery rejects in the error handler (#83113)", async () => {
2602+const sendMatrix = vi.fn().mockRejectedValue(new Error("native send failed"));
2603+queueMocks.failDelivery.mockRejectedValueOnce(new Error("db connection lost"));
2604+2605+await expect(
2606+deliverOutboundPayloads({
2607+cfg: {},
2608+channel: "matrix",
2609+to: "!room:example",
2610+payloads: [{ text: "hello" }],
2611+deps: { matrix: sendMatrix },
2612+queuePolicy: "required",
2613+}),
2614+).rejects.toThrow("native send failed");
2615+2616+expect(queueMocks.failDelivery).toHaveBeenCalledWith("mock-queue-id", expect.any(String));
2617+const warnCall = requireMockCall(logMocks.warn, "warn");
2618+const warnMessage = String(warnCall[0]);
2619+expect(warnMessage).toContain("failed to mark queued delivery");
2620+expect(warnMessage).toContain("mock-queue-id");
2621+expect(warnMessage).toContain("db connection lost");
2622+});
2623+25852624it("writes raw payloads to the queue before normalization", async () => {
25862625const sendMatrix = vi.fn().mockResolvedValue({ messageId: "m-raw", roomId: "!room:example" });
25872626const rawPayloads: DeliverOutboundPayload[] = [
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。