Skip to content

Commit

Permalink
feat: allow to set db number
Browse files Browse the repository at this point in the history
resolves #62
  • Loading branch information
KagChi committed Dec 2, 2022
1 parent e57a8ed commit 600be59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env_example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 3 additions & 1 deletion src/Structures/TaskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ export class TaskManager extends EventEmitter {
public amqpSender!: RoutingPublisher<string, Record<string, any>>;
public amqpReceiver!: RpcSubscriber<string, Record<string, any>>;
public amqpReceiverCluster!: RpcSubscriber<string, Record<string, any>>;

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,
Expand Down

0 comments on commit 600be59

Please sign in to comment.