mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
19 lines
No EOL
514 B
TypeScript
19 lines
No EOL
514 B
TypeScript
import { injectable } from "tsyringe";
|
|
import RedisClient from 'ioredis'
|
|
import { config } from "../common/config";
|
|
import { Queue, Worker, type Processor } from 'bullmq';
|
|
|
|
@injectable()
|
|
export class QueuesServices {
|
|
connection = new RedisClient(config.REDIS_URL);
|
|
|
|
constructor() { }
|
|
|
|
createQueue(name: string) {
|
|
return new Queue(name, { connection: this.connection })
|
|
}
|
|
|
|
createWorker(name: string, prcoessor: Processor) {
|
|
return new Worker(name, prcoessor, { connection: this.connection })
|
|
}
|
|
} |