feat(amsg-server): add onBeforeFire defer exit - #92
Merged
Merged
Conversation
onBeforeFire 可以返回 { defer: { afterMs } }:这次不生成、不推送,任务行只写 retry_after 并放掉租约,到点后从 onBeforeFire 重新走一遍。不占重试次数、不写 last_error、不动 next_send_at,循环任务不推进。
onFireSettled 的 status 多一种 deferred,带 retryAfter;tick 汇总新增 details.deferredTasks。过期线照常管着被推迟的任务,唤醒时刻越线时当场按过期收场。instant 请求内投递与没实现 claimTask 的适配器返回 defer 时报 AGENTIC_DEFER_UNSUPPORTED。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
onBeforeFire多一种返回值{ defer: { afterMs } }:这次先不生成,过一会儿再来问。{ defer }retry_countlast_errornext_send_atnow + afterMs(粒度是 cron 的一分钟)retry_after和租约,循环任务不推进。onFireSettled收到status: 'deferred'和retryAfter。staleAfterMs,越线按过期收场。claimTask的适配器不支持,报AGENTIC_DEFER_UNSUPPORTED。before-fire-defer。测试
包内全量 679 个通过,其中新增 23 个(
test/before-fire-defer.test.mjs)。