From ec4ce4fef36e27616c3563dbf1421c95a3b158ea Mon Sep 17 00:00:00 2001 From: Yanlong Wang Date: Tue, 14 May 2024 19:44:35 +0800 Subject: [PATCH] chore: update rate limits --- backend/functions/src/cloud-functions/crawler.ts | 8 ++++---- backend/functions/src/cloud-functions/searcher.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/functions/src/cloud-functions/crawler.ts b/backend/functions/src/cloud-functions/crawler.ts index 74a304f..efdc428 100644 --- a/backend/functions/src/cloud-functions/crawler.ts +++ b/backend/functions/src/cloud-functions/crawler.ts @@ -375,8 +375,8 @@ ${this.content} const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(rpcReflect, uid, ['CRAWL'], [ - // 1000 requests per minute - new Date(Date.now() - 60 * 1000), 1000 + // 200 requests per minute + new Date(Date.now() - 60 * 1000), 200 ] ); @@ -393,8 +393,8 @@ ${this.content} } else if (ctx.req.ip) { const apiRoll = await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.req.ip, ['CRAWL'], [ - // 100 requests per minute - new Date(Date.now() - 60 * 1000), 100 + // 20 requests per minute + new Date(Date.now() - 60 * 1000), 20 ] ); diff --git a/backend/functions/src/cloud-functions/searcher.ts b/backend/functions/src/cloud-functions/searcher.ts index 04ec255..33fc52f 100644 --- a/backend/functions/src/cloud-functions/searcher.ts +++ b/backend/functions/src/cloud-functions/searcher.ts @@ -153,8 +153,8 @@ export class SearcherHost extends RPCHost { await this.rateLimitControl.simpleRPCUidBasedLimit(rpcReflect, uid, ['CRAWL'], [ - // 1000 requests per minute - new Date(Date.now() - 60 * 1000), 1000 + // 40 requests per minute + new Date(Date.now() - 60 * 1000), 40 ] ); @@ -169,8 +169,8 @@ export class SearcherHost extends RPCHost { this.threadLocal.set('ip', ctx.req.ip); await this.rateLimitControl.simpleRpcIPBasedLimit(rpcReflect, ctx.req.ip, ['CRAWL'], [ - // 100 requests per minute - new Date(Date.now() - 60 * 1000), 100 + // 5 requests per minute + new Date(Date.now() - 60 * 1000), 5 ] ); }