mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: support argv.ignoredLimit
This commit is contained in:
1 parent
ecde94fee5
commit
8e02eb5bf9
1 file changed
+4
@@ -302,6 +302,8 @@ function serializer(k: string, v: any) {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ignoredLimit = `,${argv.options.ignoredLimit},`;
|
||||||
|
|
||||||
export class HandlerCommon {
|
export class HandlerCommon {
|
||||||
domainId: string;
|
domainId: string;
|
||||||
domain: DomainDoc;
|
domain: DomainDoc;
|
||||||
@@ -311,6 +313,8 @@ export class HandlerCommon {
|
|||||||
extraTitleContent?: string;
|
extraTitleContent?: string;
|
||||||
|
|
||||||
async limitRate(op: string, periodSecs: number, maxOperations: number) {
|
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;
|
if (this.user && this.user.hasPriv(PRIV.PRIV_UNLIMITED_ACCESS)) return;
|
||||||
await opcount.inc(op, this.request.ip, periodSecs, maxOperations);
|
await opcount.inc(op, this.request.ip, periodSecs, maxOperations);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user