mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-04-18 11:50:00 +08:00
fix: try to partition apiroll query
This commit is contained in:
parent
0238d26984
commit
4498af7280
@ -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
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 492ed4cac38958c3715013da49a9e73b1d1ef8cb
|
||||
Subproject commit 9a04a66d10635bd4e5f46123fc2b59ec802bf3b7
|
Loading…
x
Reference in New Issue
Block a user