Refactor code structure for improved readability and maintainability
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m20s
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m20s
This commit is contained in:
+18
-1
@@ -229,7 +229,11 @@ const schedulerWorker = new Worker(
|
||||
)
|
||||
}
|
||||
|
||||
console.log(`[scheduler] queued ${toQueue.length} price-update jobs (${hashtags.length - toQueue.length} already waiting)`)
|
||||
const [waitingAfter, activeAfter] = await Promise.all([
|
||||
priceUpdateQueue.getWaitingCount(),
|
||||
priceUpdateQueue.getActiveCount(),
|
||||
])
|
||||
console.log(`[scheduler] queued ${toQueue.length} price-update jobs (${hashtags.length - toQueue.length} already waiting) — queue now: waiting=${waitingAfter} active=${activeAfter}`)
|
||||
},
|
||||
{ connection: redisOpts() },
|
||||
)
|
||||
@@ -247,6 +251,9 @@ for (const [name, worker] of [['price', priceWorker], ['maintenance', maintenanc
|
||||
}
|
||||
|
||||
// Diagnostic: log when price jobs complete or stall
|
||||
priceWorker.on('active', (job) => {
|
||||
console.log(`[price-worker] active (picked up) job ${job.id} (${job.data?.tag})`)
|
||||
})
|
||||
priceWorker.on('completed', (job) => {
|
||||
console.log(`[price-worker] completed job ${job.id} (${job.data?.tag})`)
|
||||
})
|
||||
@@ -254,6 +261,16 @@ priceWorker.on('stalled', (jobId) => {
|
||||
console.warn(`[price-worker] stalled job ${jobId} — lock expired, will retry`)
|
||||
})
|
||||
|
||||
// Log queue depths every 30 s so we can see if jobs are piling up or vanishing
|
||||
setInterval(async () => {
|
||||
const [waiting, active, failed] = await Promise.all([
|
||||
priceUpdateQueue.getWaitingCount(),
|
||||
priceUpdateQueue.getActiveCount(),
|
||||
priceUpdateQueue.getFailedCount(),
|
||||
])
|
||||
console.log(`[price-queue] waiting=${waiting} active=${active} failed=${failed}`)
|
||||
}, 30_000)
|
||||
|
||||
// ── Repeatable jobs ───────────────────────────────────────────────────────────
|
||||
|
||||
async function setupRepeatableJobs() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user