lint issues
This commit is contained in:
parent
19dfda2392
commit
190b725149
7 changed files with 71 additions and 28 deletions
|
|
@ -1,6 +1,14 @@
|
|||
import { RateLimiterRedis, RateLimiterRes } from 'rate-limiter-flexible';
|
||||
import type { RateLimitConfig as BaseRateLimitConfig, RateLimitRule } from './types';
|
||||
|
||||
// Logger interface for type safety
|
||||
interface Logger {
|
||||
info(message: string, meta?: Record<string, unknown>): void;
|
||||
error(message: string, meta?: Record<string, unknown>): void;
|
||||
warn(message: string, meta?: Record<string, unknown>): void;
|
||||
debug(message: string, meta?: Record<string, unknown>): void;
|
||||
}
|
||||
|
||||
// Extend the base config to add rate-limiter specific fields
|
||||
export interface RateLimitConfig extends BaseRateLimitConfig {
|
||||
keyPrefix?: string;
|
||||
|
|
@ -9,11 +17,11 @@ export interface RateLimitConfig extends BaseRateLimitConfig {
|
|||
export class QueueRateLimiter {
|
||||
private limiters = new Map<string, RateLimiterRedis>();
|
||||
private rules: RateLimitRule[] = [];
|
||||
private readonly logger: any;
|
||||
private readonly logger: Logger;
|
||||
|
||||
constructor(
|
||||
private redisClient: ReturnType<typeof import('./utils').getRedisConnection>,
|
||||
logger?: any
|
||||
logger?: Logger
|
||||
) {
|
||||
this.logger = logger || console;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue