chore: agents update

This commit is contained in:
xiaojunnuo
2026-05-05 22:17:09 +08:00
parent 91a1b97550
commit 72b6597817
3 changed files with 47 additions and 3 deletions
@@ -18,6 +18,7 @@ export class TldClient {
{ windowMs: 24 * 60 * 60 * 1000, max: 12000 },
];
private static readonly RDAP_SS_MAX_WAIT_MS = 3 * 60 * 1000;
private static readonly RDAP_SS_DATA_RETENTION_MS = 24 * 60 * 60 * 1000;
private static rdapSsRequestTimes: number[] = [];
private rdapMap: Record<string, string> = {};
@@ -177,8 +178,7 @@ export class TldClient {
private async waitRdapSsRateLimit() {
while (true) {
const now = Date.now();
const maxWindowMs = Math.max(...TldClient.RDAP_SS_RATE_LIMITS.map(item => item.windowMs));
TldClient.rdapSsRequestTimes = TldClient.rdapSsRequestTimes.filter(time => now - time < maxWindowMs);
TldClient.rdapSsRequestTimes = TldClient.rdapSsRequestTimes.filter(time => now - time < TldClient.RDAP_SS_DATA_RETENTION_MS);
const waitMs = TldClient.RDAP_SS_RATE_LIMITS.reduce((maxWaitMs, limit) => {
const times = TldClient.rdapSsRequestTimes.filter(time => now - time < limit.windowMs);