mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-15 08:25:54 +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()) || [
|
||||||
|
parseInt(user.metadata?.speed_level) >= 2 ?
|
||||||
|
RateLimitDesc.from({
|
||||||
|
occurrence: 1000,
|
||||||
|
periodSeconds: 60
|
||||||
|
}) :
|
||||||
|
RateLimitDesc.from({
|
||||||
occurrence: 200,
|
occurrence: 200,
|
||||||
periodSeconds: 60
|
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()) || [
|
||||||
|
parseInt(user.metadata?.speed_level) >= 2 ?
|
||||||
|
RateLimitDesc.from({
|
||||||
|
occurrence: 200,
|
||||||
|
periodSeconds: 60
|
||||||
|
}) :
|
||||||
|
RateLimitDesc.from({
|
||||||
occurrence: 40,
|
occurrence: 40,
|
||||||
periodSeconds: 60
|
periodSeconds: 60
|
||||||
})];
|
})
|
||||||
|
];
|
||||||
|
|
||||||
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
const apiRoll = await this.rateLimitControl.simpleRPCUidBasedLimit(
|
||||||
rpcReflect, uid, [rpcReflect.name.toUpperCase()],
|
rpcReflect, uid, [rpcReflect.name.toUpperCase()],
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit a26b633136a2651f01dcf02b47efc35b2401d807
|
Subproject commit fe71cc2433f60ada86622f1670a752da40806e4d
|
Loading…
x
Reference in New Issue
Block a user