mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: allow rate limit override
This commit is contained in:
1 parent
a70c55e585
commit
688ccf811b
2 files changed
+4
-3
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user