mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-15 00:55:55 +08:00
feat: updated rate policy
This commit is contained in:
parent
0a2c0932fd
commit
cda0f371e1
@ -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.`);
|
throw new InsufficientBalanceError(`Account balance not enough to run this query, please recharge.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [RateLimitDesc.from({
|
const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [
|
||||||
occurrence: 200,
|
parseInt(user.metadata?.speed_level) >= 2 ?
|
||||||
periodSeconds: 60
|
RateLimitDesc.from({
|
||||||
})];
|
occurrence: 1000,
|
||||||
|
periodSeconds: 60
|
||||||
|
}) :
|
||||||
|
RateLimitDesc.from({
|
||||||
|
occurrence: 200,
|
||||||
|
periodSeconds: 60
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
||||||
rpcReflect, uid, [rpcReflect.name.toUpperCase()],
|
rpcReflect, uid, [rpcReflect.name.toUpperCase()],
|
||||||
|
@ -109,10 +109,17 @@ export class SearcherHost 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()) || [RateLimitDesc.from({
|
const rateLimitPolicy = auth.getRateLimits(rpcReflect.name.toUpperCase()) || [
|
||||||
occurrence: 40,
|
parseInt(user.metadata?.speed_level) >= 2 ?
|
||||||
periodSeconds: 60
|
RateLimitDesc.from({
|
||||||
})];
|
occurrence: 200,
|
||||||
|
periodSeconds: 60
|
||||||
|
}) :
|
||||||
|
RateLimitDesc.from({
|
||||||
|
occurrence: 40,
|
||||||
|
periodSeconds: 60
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
||||||
rpcReflect, uid, [rpcReflect.name.toUpperCase()],
|
rpcReflect, uid, [rpcReflect.name.toUpperCase()],
|
||||||
@ -334,7 +341,7 @@ export class SearcherHost extends RPCHost {
|
|||||||
r.description = upstreamSearchResult.description;
|
r.description = upstreamSearchResult.description;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}).catch((err)=> {
|
}).catch((err) => {
|
||||||
this.logger.error(`Failed to format snapshot for ${urls[i].href}`, { err: marshalErrorLike(err) });
|
this.logger.error(`Failed to format snapshot for ${urls[i].href}`, { err: marshalErrorLike(err) });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit a26b633136a2651f01dcf02b47efc35b2401d807
|
Subproject commit fe71cc2433f60ada86622f1670a752da40806e4d
|
Loading…
x
Reference in New Issue
Block a user