mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-05-08 01:30:01 -05: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,
|
connection: this.connection,
|
||||||
concurrency: 5,
|
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) => {
|
worker.on("failed", (job, err) => {
|
||||||
this.logger.error({
|
this.logger.error({
|
||||||
message: `Worker failed job: ${job.id}`,
|
message: `Worker failed job: ${job.id}`,
|
||||||
@@ -225,6 +242,14 @@ class NewJobQueue {
|
|||||||
stack: err.stack,
|
stack: err.stack,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
worker.on("stalled", (jobId) => {
|
||||||
|
this.logger.warn({
|
||||||
|
message: `Worker stalled job: ${jobId}`,
|
||||||
|
service: SERVICE_NAME,
|
||||||
|
method: "createWorker",
|
||||||
|
});
|
||||||
|
});
|
||||||
return worker;
|
return worker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,8 +378,9 @@ class NewJobQueue {
|
|||||||
const jobs = await queue.getJobs();
|
const jobs = await queue.getJobs();
|
||||||
const ret = await Promise.all(
|
const ret = await Promise.all(
|
||||||
jobs.map(async (job) => {
|
jobs.map(async (job) => {
|
||||||
|
console.log(job);
|
||||||
const state = await job.getState();
|
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 };
|
stats[name] = { jobs: ret, workers: this.workers[name].length };
|
||||||
|
|||||||
Reference in New Issue
Block a user