lint issues
This commit is contained in:
parent
19dfda2392
commit
190b725149
7 changed files with 71 additions and 28 deletions
|
|
@ -3,6 +3,16 @@ import { handlerRegistry } from '@stock-bot/types';
|
|||
import type { JobData, JobOptions, QueueStats, RedisConfig } from './types';
|
||||
import { getRedisConnection } from './utils';
|
||||
|
||||
// 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;
|
||||
trace(message: string, meta?: Record<string, unknown>): void;
|
||||
child?(name: string, context?: Record<string, unknown>): Logger;
|
||||
}
|
||||
|
||||
export interface QueueWorkerConfig {
|
||||
workers?: number;
|
||||
concurrency?: number;
|
||||
|
|
@ -19,14 +29,14 @@ export class Queue {
|
|||
private queueEvents?: QueueEvents;
|
||||
private queueName: string;
|
||||
private redisConfig: RedisConfig;
|
||||
private readonly logger: any;
|
||||
private readonly logger: Logger;
|
||||
|
||||
constructor(
|
||||
queueName: string,
|
||||
redisConfig: RedisConfig,
|
||||
defaultJobOptions: JobOptions = {},
|
||||
config: QueueWorkerConfig = {},
|
||||
logger?: any
|
||||
logger?: Logger
|
||||
) {
|
||||
this.queueName = queueName;
|
||||
this.redisConfig = redisConfig;
|
||||
|
|
@ -246,7 +256,7 @@ export class Queue {
|
|||
* Create a child logger with additional context
|
||||
* Useful for batch processing and other queue operations
|
||||
*/
|
||||
createChildLogger(name: string, context?: any) {
|
||||
createChildLogger(name: string, context?: Record<string, unknown>) {
|
||||
if (this.logger && typeof this.logger.child === 'function') {
|
||||
return this.logger.child(name, context);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue