Repository navigation
feat(claim): 支持每日领取时间窗口 - #78
Closed
Catapult291 wants to merge 1 commit into
Closed
Catapult291 wants to merge 1 commit into
Catapult291 wants to merge 1 commit into
Conversation
- claim.window 配置 "HH:MM-HH:MM"(UTC+8),留空保持全天轮询 - 窗口外不发 preview 请求;成功领取后 hold 到次日窗口起点 - loader 加载时校验格式,非法配置启动即报错 - 补充窗口边界、跨日 hold 与 parse 工具测试
Owner
|
但是这个改动我也没有看到额外的收益啊,添加这个功能直接最后的结果还是一样的 |
Owner
|
close了 |
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.
背景
claim调度器目前全天按pollIntervalMs轮询 preview。每日活动的领取额度一天只有一次,窗口外的轮询只会产生无效请求;同一天领取成功后再轮询同一窗口也没有收益。改动
claim.window: "HH:MM-HH:MM"(UTC+8 墙钟,24 小时制,起点包含、终点不包含)。留空或不配 = 保持现在的全天轮询,现有行为零变化。tick()直接返回idle并 hold 到下一个开窗点,不发送任何 upstream 请求;hold 由scheduleNext按pollIntervalMs重新武装,进程重启或改配置立即生效。max(ends_at, 次日窗口起点),避免同一天重复轮询烧每日额度。loader在加载时校验格式与范围,非法配置启动即报错。window: "19:00-20:30"。测试
src/claim/scheduler.test.ts:窗口外抑制、窗口内正常轮询、成功后跨日 hold、起点包含/终点不包含、未配置窗口保持原行为;parseClaimWindow/minutesUntilWindow的解析与边界。src/config/loader.test.ts:默认值、window 透传、非法格式启动报错。bunx tsc --noEmit干净,bun test1138 pass / 0 fail。