🐂 Migration to moleculer-bullMQ #6

Merged
rishighan merged 21 commits from migration-to-bullmq into master 2023-08-30 17:50:47 +00:00
2 changed files with 4 additions and 1 deletions
Showing only changes of commit 5540bb16ec - Show all commits

View File

@@ -3,7 +3,8 @@ const mongoose = require("mongoose");
const JobResultScehma = mongoose.Schema({
id: Number,
status: String,
failedReason: Object
failedReason: Object,
timestamp: Date,
});
const JobResult = mongoose.model("JobResult", JobResultScehma);

View File

@@ -188,6 +188,7 @@ export default class JobQueueService extends Service {
async "enqueue.async.completed"(ctx: Context<{ id: Number }>) {
// 1. Fetch the job result using the job Id
const job = await this.job(ctx.params.id);
console.log(job);
// 2. Increment the completed job counter
await pubClient.incr("completedJobCount");
// 3. Fetch the completed job count for the final payload to be sent to the client
@@ -208,6 +209,7 @@ export default class JobQueueService extends Service {
await JobResult.create({
id: ctx.params.id,
status: "completed",
timestamp: job.timestamp,
failedReason: {},
});