perf(auth): 延长 API Key 校验缓存 TTL - #287
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #287 +/- ##
==========================================
+ Coverage 72.50% 72.54% +0.04%
==========================================
Files 245 245
Lines 14519 14519
Branches 4836 4836
==========================================
+ Hits 10527 10533 +6
+ Misses 2605 2600 -5
+ Partials 1387 1386 -1
🚀 New features to boost your workflow:
|
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.
Summary
将 API Key bcrypt 成功校验缓存 TTL 从 10 秒延长到 120 秒,匹配生产请求间隔,降低重复请求的 cold-path 认证开销。
Related Issue
无。
Type of Change
Changes
API_KEY_VERIFY_CACHE_TTL_MS:10_000→120_000。Test Plan
pnpm test:run tests/unit/utils/auth.test.tspnpm exec tsc --noEmitpnpm lintChecklist
Additional Notes
生产日志调查显示 beta3 发布后的请求间隔 P50 约 25 秒、P75 约 106 秒;10 秒 TTL 在最新请求中没有命中,120 秒覆盖当前样本约 63% 的相邻请求。