diff --git a/.env_example b/.env_example index 3e9dc9a..222e95d 100644 --- a/.env_example +++ b/.env_example @@ -4,5 +4,6 @@ REDIS_HOST = "localhost" REDIS_PORT = 6379 REDIS_USERNAME = REDIS_PASSWORD = +REDIS_DB = AMQP_HOST = "amqp://guest:guest@localhost" AMQP_QUEUE_NAME = "scheduled-tasks" \ No newline at end of file diff --git a/src/Structures/TaskManager.ts b/src/Structures/TaskManager.ts index 4c52d2e..dc574d3 100644 --- a/src/Structures/TaskManager.ts +++ b/src/Structures/TaskManager.ts @@ -19,12 +19,14 @@ export class TaskManager extends EventEmitter { public amqpSender!: RoutingPublisher>; public amqpReceiver!: RpcSubscriber>; public amqpReceiverCluster!: RpcSubscriber>; + public bull = new Bull(`${process.env.QUEUE_NAME ?? "scheduled-tasks"}-cluster-${this.clusterId}`, { redis: { host: process.env.REDIS_HOST!, port: parseInt(process.env.REDIS_PORT!), username: process.env.REDIS_USERNAME, - password: process.env.REDIS_PASSWORD + password: process.env.REDIS_PASSWORD, + db: parseInt(process.env.REDIS_DB!) }, defaultJobOptions: { removeOnComplete: true,