cleanup: trim trailing whitespace (#11136)
* cleanup: trim trailing whitespace * update(`.editorconfig`) --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
4c879b3a33
commit
d84796588c
161 changed files with 615 additions and 609 deletions
|
@ -38,14 +38,14 @@ export class RateLimiterService {
|
|||
max: 1,
|
||||
db: this.redisClient,
|
||||
});
|
||||
|
||||
|
||||
minIntervalLimiter.get((err, info) => {
|
||||
if (err) {
|
||||
return reject('ERR');
|
||||
}
|
||||
|
||||
|
||||
this.logger.debug(`${actor} ${limitation.key} min remaining: ${info.remaining}`);
|
||||
|
||||
|
||||
if (info.remaining === 0) {
|
||||
reject('BRIEF_REQUEST_INTERVAL');
|
||||
} else {
|
||||
|
@ -57,7 +57,7 @@ export class RateLimiterService {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Long term limit
|
||||
const max = (): void => {
|
||||
const limiter = new Limiter({
|
||||
|
@ -66,14 +66,14 @@ export class RateLimiterService {
|
|||
max: limitation.max! / factor,
|
||||
db: this.redisClient,
|
||||
});
|
||||
|
||||
|
||||
limiter.get((err, info) => {
|
||||
if (err) {
|
||||
return reject('ERR');
|
||||
}
|
||||
|
||||
|
||||
this.logger.debug(`${actor} ${limitation.key} max remaining: ${info.remaining}`);
|
||||
|
||||
|
||||
if (info.remaining === 0) {
|
||||
reject('RATE_LIMIT_EXCEEDED');
|
||||
} else {
|
||||
|
@ -81,13 +81,13 @@ export class RateLimiterService {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const hasShortTermLimit = typeof limitation.minInterval === 'number';
|
||||
|
||||
|
||||
const hasLongTermLimit =
|
||||
typeof limitation.duration === 'number' &&
|
||||
typeof limitation.max === 'number';
|
||||
|
||||
|
||||
if (hasShortTermLimit) {
|
||||
min();
|
||||
} else if (hasLongTermLimit) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue