refactor: do not check long term limit inside min

This commit is contained in:
anatawa12 2024-06-14 17:36:44 +09:00
parent b3561ce425
commit f72c768407
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
1 changed files with 3 additions and 8 deletions

View File

@ -63,11 +63,7 @@ export class RateLimiterService {
// eslint-disable-next-line no-throw-literal // eslint-disable-next-line no-throw-literal
throw { code: 'BRIEF_REQUEST_INTERVAL', info }; throw { code: 'BRIEF_REQUEST_INTERVAL', info };
} else { } else {
if (hasLongTermLimit) { return;
await max();
} else {
return;
}
} }
}; };
@ -98,10 +94,9 @@ export class RateLimiterService {
if (hasShortTermLimit) { if (hasShortTermLimit) {
await min(); await min();
} else if (hasLongTermLimit) { }
if (hasLongTermLimit) {
await max(); await max();
} else {
return;
} }
} }
} }