fix(admin-usage): 对齐 last24hours 为滚动 24 小时窗口#4153
Closed
zy6p wants to merge 1 commit into
Closed
Conversation
修复 admin/user 的 usage 与 dashboard 将「最近 24 小时」按日历日期 start_date/end_date 近似的问题。统一改用 period=last24hours,由后端 计算真实的滚动 [now-24h, now] 窗口,并补充前后端回归测试。
Contributor
Author
|
recheck |
Owner
|
1、滚动窗口把秒级 startTime 灌入 7 个 snapshotCache map 作 key,该缓存Set 无淘汰、过期仅在同 key 复读时删除 → admin 默认视图每次请求都泄漏一条 KB 级 entry 且缓存零命中; |
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.
说明
start_date/end_date近似 24 小时,实际会变成「今天 + 昨天」两天整段,而不是滚动的最近 24 小时period=last24hours,由后端按用户时区计算真实的滚动窗口[now-24h, now]start_time/end_time/period元数据,避免仅按日期展示时丢失时间精度背景
旧 PR #1716 长期未合并且与最新
main产生冲突,已关闭。本 PR 基于最新上游main重新实现同一修复。验证
go test ./internal/pkg/timezone ./internal/handler ./internal/handler/adminpnpm exec vitest run src/views/user/__tests__/DashboardView.spec.ts src/views/user/__tests__/UsageView.spec.ts src/views/admin/__tests__/DashboardView.spec.ts src/views/admin/__tests__/UsageView.spec.ts