fix(outbound): preserve retries for budget-deferred deliveries (#91241) · openclaw/openclaw@75c1790
849261680
·
2026-06-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -326,17 +326,6 @@ async function moveEntryToFailedWithLogging(
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | | -async function deferRemainingEntriesForBudget( |
330 | | -entries: readonly QueuedDelivery[], |
331 | | -stateDir: string | undefined, |
332 | | -): Promise<void> { |
333 | | -// Increment retryCount so entries that are repeatedly deferred by the |
334 | | -// recovery budget eventually hit MAX_RETRIES and get pruned. |
335 | | -await Promise.allSettled( |
336 | | -entries.map((entry) => failDelivery(entry.id, "recovery time budget exceeded", stateDir)), |
337 | | -); |
338 | | -} |
339 | | - |
340 | 329 | /** Compute the backoff delay in ms for a given retry count. */ |
341 | 330 | export function computeBackoffMs(retryCount: number): number { |
342 | 331 | if (retryCount <= 0) { |
@@ -624,12 +613,12 @@ export async function recoverPendingDeliveries(opts: {
|
624 | 613 | const deadline = resolveRecoveryDeadlineMs(opts.maxRecoveryMs); |
625 | 614 | const summary = createEmptyRecoverySummary(); |
626 | 615 | |
627 | | -for (let i = 0; i < pending.length; i++) { |
628 | | -const entry = pending[i]; |
| 616 | +for (const entry of pending) { |
629 | 617 | const now = Date.now(); |
630 | 618 | if (now >= deadline) { |
631 | 619 | opts.log.warn(`Recovery time budget exceeded — remaining entries deferred to next startup`); |
632 | | -await deferRemainingEntriesForBudget(pending.slice(i), opts.stateDir); |
| 620 | +// Budget deferral is not a delivery attempt. Keep entries pending without |
| 621 | +// consuming retry budget; attempted failures still flow through failDelivery. |
633 | 622 | break; |
634 | 623 | } |
635 | 624 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -615,7 +615,7 @@ describe("delivery-queue recovery", () => {
|
615 | 615 | }); |
616 | 616 | }); |
617 | 617 | |
618 | | -it("respects maxRecoveryMs time budget and bumps deferred retries", async () => { |
| 618 | +it("respects maxRecoveryMs time budget without bumping deferred retries", async () => { |
619 | 619 | await enqueueCrashRecoveryEntries(); |
620 | 620 | await enqueueDelivery( |
621 | 621 | { channel: "demo-channel-c", to: "#c", payloads: [{ text: "c" }] }, |
@@ -638,8 +638,7 @@ describe("delivery-queue recovery", () => {
|
638 | 638 | |
639 | 639 | const remaining = await loadPendingDeliveries(tmpDir()); |
640 | 640 | expect(remaining).toHaveLength(3); |
641 | | -const entriesWithUnexpectedRetryCount = remaining.filter((entry) => entry.retryCount !== 1); |
642 | | -expect(entriesWithUnexpectedRetryCount).toStrictEqual([]); |
| 641 | +expect(remaining.map((entry) => entry.retryCount)).toStrictEqual([0, 0, 0]); |
643 | 642 | expectMockMessageContaining(log.warn, "deferred to next startup"); |
644 | 643 | }); |
645 | 644 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。