fix: 修复内存限流存储异步签名
CI / Static checks (pull_request) Successful in 6m32s
CI / Production build (pull_request) Successful in 5m53s
CI / API integration (pull_request) Has been cancelled
CI / Browser smoke (pull_request) Has been cancelled

This commit is contained in:
que01 committed 2026-10-23 14:35:55 +08:00
1 parent a1b29cedee
commit d923b8cea9
2 files changed
+5 -8

No files matched your search

@@ -24,19 +24,16 @@ export class MemoryClientErrorThrottleStore implements ClientErrorThrottleStore
private readonly recentErrorIds = new Map<string, number>();
private readonly windows = new Map<string, number[]>();
async record(
report: ClientErrorThrottleReport,
now = Date.now(),
): Promise<ClientErrorThrottleResult> {
record(report: ClientErrorThrottleReport, now = Date.now()): Promise<ClientErrorThrottleResult> {
this.prune(now);
const dedupeKey = `${report.subject}:${report.errorId}`;
if (this.recentErrorIds.has(dedupeKey)) return { duplicate: true };
if (this.recentErrorIds.has(dedupeKey)) return Promise.resolve({ duplicate: true });
this.assertWithinRate(report.subject, now);
this.recentErrorIds.set(dedupeKey, now);
this.trimDedupe();
return { duplicate: false };
return Promise.resolve({ duplicate: false });
}
private assertWithinRate(subject: string, now: number): void {