diff --git a/backend/functions/src/cloud-functions/crawler.ts b/backend/functions/src/cloud-functions/crawler.ts index 357e8b8..7b03143 100644 --- a/backend/functions/src/cloud-functions/crawler.ts +++ b/backend/functions/src/cloud-functions/crawler.ts @@ -644,10 +644,17 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`; throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`); } - const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [RateLimitDesc.from({ - occurrence: 200, - periodSeconds: 60 - })]; + const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [ + parseInt(user.metadata?.speed_level) >= 2 ? + RateLimitDesc.from({ + occurrence: 1000, + periodSeconds: 60 + }) : + RateLimitDesc.from({ + occurrence: 200, + periodSeconds: 60 + }) + ]; const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit( rpcReflect, uid, [rpcReflect.name.toUpperCase()], diff --git a/backend/functions/src/cloud-functions/searcher.ts b/backend/functions/src/cloud-functions/searcher.ts index 0a5a736..7b1c572 100644 --- a/backend/functions/src/cloud-functions/searcher.ts +++ b/backend/functions/src/cloud-functions/searcher.ts @@ -109,10 +109,17 @@ export class SearcherHost extends RPCHost { throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`); } - const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [RateLimitDesc.from({ - occurrence: 40, - periodSeconds: 60 - })]; + const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [ + parseInt(user.metadata?.speed_level) >= 2 ? + RateLimitDesc.from({ + occurrence: 200, + periodSeconds: 60 + }) : + RateLimitDesc.from({ + occurrence: 40, + periodSeconds: 60 + }) + ]; const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit( rpcReflect, uid, [rpcReflect.name.toUpperCase()], @@ -334,7 +341,7 @@ export class SearcherHost extends RPCHost { r.description = upstreamSearchResult.description; return r; - }).catch((err)=> { + }).catch((err) => { this.logger.error(`Failed to format snapshot for ${urls[i].href}`, { err: marshalErrorLike(err) }); return { diff --git a/thinapps-shared b/thinapps-shared index a26b633..fe71cc2 160000 --- a/thinapps-shared +++ b/thinapps-shared @@ -1 +1 @@ -Subproject commit a26b633136a2651f01dcf02b47efc35b2401d807 +Subproject commit fe71cc2433f60ada86622f1670a752da40806e4d