mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-18 23:59:41 -06:00
Merge pull request #1521 from bluewave-labs/hotfix/be/jobqueue-logging
hotfic: add more logging to jobqueue
This commit is contained in:
@@ -217,6 +217,23 @@ class NewJobQueue {
|
||||
connection: this.connection,
|
||||
concurrency: 5,
|
||||
});
|
||||
|
||||
worker.on("active", (job) => {
|
||||
this.logger.info({
|
||||
message: `Worker started processing job: ${job.id}`,
|
||||
service: SERVICE_NAME,
|
||||
method: "createWorker",
|
||||
});
|
||||
});
|
||||
|
||||
worker.on("completed", (job) => {
|
||||
this.logger.info({
|
||||
message: `Worker completed job: ${job.id}`,
|
||||
service: SERVICE_NAME,
|
||||
method: "createWorker",
|
||||
});
|
||||
});
|
||||
|
||||
worker.on("failed", (job, err) => {
|
||||
this.logger.error({
|
||||
message: `Worker failed job: ${job.id}`,
|
||||
@@ -225,6 +242,14 @@ class NewJobQueue {
|
||||
stack: err.stack,
|
||||
});
|
||||
});
|
||||
|
||||
worker.on("stalled", (jobId) => {
|
||||
this.logger.warn({
|
||||
message: `Worker stalled job: ${jobId}`,
|
||||
service: SERVICE_NAME,
|
||||
method: "createWorker",
|
||||
});
|
||||
});
|
||||
return worker;
|
||||
}
|
||||
|
||||
@@ -353,8 +378,9 @@ class NewJobQueue {
|
||||
const jobs = await queue.getJobs();
|
||||
const ret = await Promise.all(
|
||||
jobs.map(async (job) => {
|
||||
console.log(job);
|
||||
const state = await job.getState();
|
||||
return { url: job.data.url, state };
|
||||
return { url: job.data.url, state, progress: job.progress };
|
||||
})
|
||||
);
|
||||
stats[name] = { jobs: ret, workers: this.workers[name].length };
|
||||
|
||||
Reference in New Issue
Block a user