fix: 修复内存限流存储异步签名
This commit is contained in:
1 parent
a1b29cedee
commit
d923b8cea9
2 files changed
+5
-8
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"scope": "模板完成证据登记,保留命令、日志与产物哈希",
|
||||
"generatedAt": "2026-10-23T06:32:05.523Z",
|
||||
"generatedAt": "2026-10-23T06:35:59.337Z",
|
||||
"templates": {
|
||||
"acheng-campus-food": {
|
||||
"real-manifest-interaction": {
|
||||
@@ -256,5 +256,5 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"sourceTreeHash": "1e2a205c5faf17468eddc4526c462f9d7d749447d7e43c4087fb6b08f8244223"
|
||||
"sourceTreeHash": "f39e31a1959e24c07bf60776a0d3c5f28e5745962ca004301ff304daa1430041"
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user