Skip to content

Commit

Permalink
feat: allow to set redis username
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Jul 23, 2022
1 parent 6adad65 commit 6ba2157
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env_example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ TOTAL_CLUSTERS = 6
QUEUE_NAME = "scheduled-tasks"
REDIS_HOST = "localhost"
REDIS_PORT = 6379
REDIS_USERNAME =
REDIS_PASSWORD =
AMQP_HOST = "amqp://guest:guest@localhost"
AMQP_QUEUE_NAME = "scheduled-tasks"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nezuchan/scheduled-tasks",
"version": "1.0.1",
"version": "1.0.2",
"description": "A Standalone scheduled tasks service for microserviced \"Discord\" bot.",
"main": "dist/index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/Structures/TaskManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class TaskManager extends EventEmitter {
redis: {
host: process.env.REDIS_HOST!,
port: parseInt(process.env.REDIS_PORT!),
username: process.env.REDIS_USERNAME,
password: process.env.REDIS_PASSWORD
},
defaultJobOptions: {
Expand Down
6 changes: 4 additions & 2 deletions src/Utilities/handleJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ export async function handleJob(message: Record<string, any>, bull: Bull.Queue,
return JSON.stringify({ message: "Jobs found !", jobs, fromCluster: clusterId });
}
default: {
manager.logger.warn(message, `Unhandled job type ${message.type}`);
return JSON.stringify({ message: "Unhandled job, please open issue if you need this to be handled or this is missing from the implementation !" });
if (message.type) {
manager.logger.warn(message, `Unhandled job type ${message.type}`);
return JSON.stringify({ message: "Unhandled job, please open issue if you need this to be handled or this is missing from the implementation !" });
}
}
}
}
Expand Down

0 comments on commit 6ba2157

Please sign in to comment.