Add debug

This commit is contained in:
2022-08-06 20:55:51 +03:00
parent 462032a4e9
commit 376fd7aa35
3 changed files with 20 additions and 1 deletions

View File

@@ -2,10 +2,12 @@ import { createClient, RedisClientType } from 'redis';
import env from '@/config';
import debug from 'debug';
import Sentry from '@/sentry';
export default class Limiter {
static debugger = debug("limiter");
static MAX_PROCESSING_COUNT: number = 3;
static _redisClient: RedisClientType | null = null;
@@ -41,6 +43,9 @@ export default class Limiter {
static async isLimited(updateId: number): Promise<boolean> {
const count = await this._getCount(updateId);
this.debugger(`${updateId}: ${count}`)
return count <= this.MAX_PROCESSING_COUNT;
}
}