mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-07-31 12:02: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.`);
|
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 ?
|
parseInt(user.metadata?.speed_level) >= 2 ?
|
||||||
RateLimitDesc.from({
|
RateLimitDesc.from({
|
||||||
occurrence: 2000,
|
occurrence: 2000,
|
||||||
@ -271,7 +271,7 @@ export class CrawlerHost extends RPCHost {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
||||||
rpcReflect, uid, [rpcReflect.name.toUpperCase()],
|
rpcReflect, uid, ['CRAWL'],
|
||||||
...rateLimitPolicy
|
...rateLimitPolicy
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -287,7 +287,7 @@ export class CrawlerHost extends RPCHost {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (ctx.ip) {
|
} 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
|
// 20 requests per minute
|
||||||
new Date(Date.now() - 60 * 1000), 20
|
new Date(Date.now() - 60 * 1000), 20
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 492ed4cac38958c3715013da49a9e73b1d1ef8cb
|
Subproject commit 9a04a66d10635bd4e5f46123fc2b59ec802bf3b7
|
Loading…
x
Reference in New Issue
Block a user