core: allow rate limit override

This commit is contained in:
undefined committed 2022-01-22 16:55:00 +08:00
1 parent a70c55e585
commit 688ccf811b
2 files changed
+4 -3

No files matched your search

+2 -1
View File
@@ -314,8 +314,9 @@ export class HandlerCommon {
async limitRate(op: string, periodSecs: number, maxOperations: number) {
if (ignoredLimit.includes(op)) return;
// TODO: support limit override
if (this.user && this.user.hasPriv(PRIV.PRIV_UNLIMITED_ACCESS)) return;
const overrideLimit = system.get(`limit.${op}`);
if (overrideLimit) maxOperations = overrideLimit;
await opcount.inc(op, this.request.ip, periodSecs, maxOperations);
}