From 4498af728011da71c58f2da039ec5673f353f752 Mon Sep 17 00:00:00 2001 From: "yanlong.wang" Date: Tue, 1 Apr 2025 18:28:48 +0800 Subject: [PATCH] fix: try to partition apiroll query --- src/api/crawler.ts | 6 +++--- thinapps-shared | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/crawler.ts b/src/api/crawler.ts index 5bbd48a..a82c0d3 100644 --- a/src/api/crawler.ts +++ b/src/api/crawler.ts @@ -258,7 +258,7 @@ export class CrawlerHost extends RPCHost { throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`); } - const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [ + const rateLimitPolicy = auth.getRateLimits('CRAWL') || [ parseInt(user.metadata?.speed_level) >= 2 ? RateLimitDesc.from({ occurrence: 2000, @@ -271,7 +271,7 @@ export class CrawlerHost extends RPCHost { ]; const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit( - rpcReflect, uid, [rpcReflect.name.toUpperCase()], + rpcReflect, uid, ['CRAWL'], ...rateLimitPolicy ); @@ -287,7 +287,7 @@ export class CrawlerHost extends RPCHost { } }); } else if (ctx.ip) { - const apiRoll = await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.ip, [rpcReflect.name.toUpperCase()], + const apiRoll = await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.ip, ['CRAWL'], [ // 20 requests per minute new Date(Date.now() - 60 * 1000), 20 diff --git a/thinapps-shared b/thinapps-shared index 492ed4c..9a04a66 160000 --- a/thinapps-shared +++ b/thinapps-shared @@ -1 +1 @@ -Subproject commit 492ed4cac38958c3715013da49a9e73b1d1ef8cb +Subproject commit 9a04a66d10635bd4e5f46123fc2b59ec802bf3b7