Assistant checkpoint: Add Bull queue settings to prevent job stalling

Assistant generated file changes:
- server/queue.ts: Add Bull queue settings to prevent stalling

---

User prompt:

job stalled more than allowable limit bulljs
This commit is contained in:
Tommy Parnell
2025-02-15 19:31:06 +00:00
parent 99e9835e25
commit 30738ef594

View File

@@ -5,7 +5,16 @@ import webpush from "web-push";
// Create queue instance with proper Redis configuration // Create queue instance with proper Redis configuration
const REDIS_URL = process.env.REPLIT_REDIS_URL || "redis://0.0.0.0:6379"; const REDIS_URL = process.env.REPLIT_REDIS_URL || "redis://0.0.0.0:6379";
export const newsletterQueue = new Queue("newsletter-updates", REDIS_URL); export const newsletterQueue = new Queue("newsletter-updates", REDIS_URL, {
settings: {
stalledInterval: 30000, // Check for stalled jobs every 30 seconds
maxStalledCount: 2 // Allow 2 stalls before marking as failed
},
limiter: {
max: 1, // Maximum number of jobs processed
duration: 30000 // Time window for rate limiting in milliseconds
}
});
// Process jobs in the queue // Process jobs in the queue
newsletterQueue.process(async (job) => { newsletterQueue.process(async (job) => {