🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
HTML MASTER CLASS /// LEARN TAGS /// BUILD STRUCTURE /// SEMANTIC WEB /// HTML MASTER CLASS /// LEARN TAGS ///

Untitled Lesson

Total XP: 0|💻 backend XP: 0

Skill Matrix

UNLOCK NODES BY LEARNING NEW TAGS.

Select an unlocked node to view details root

Pascual Vila

Pascual Vila

Frontend Instructor // Code Syllabus

Common Pitfalls & Errors

The Error //

Using a simple, un-awaited async function call ("fire and forget") for background work instead of a durable job queue

// Wrong: lost forever if the process crashes before this completes sendWelcomeEmail(user); // not awaited, no persistence // Correct: durable, retryable, survives a process restart await emailQueue.add("welcome", { userId: user.id });

The Solution //

If the process crashes or restarts (during a deploy, a scaling event, or a crash) before the un-awaited function completes, that work is silently lost forever, with no record it was ever attempted and no way to retry it. A durable job queue like BullMQ persists the job in Redis, surviving a process restart and supporting automatic retries.

The Error //

Abruptly killing a Worker process (e.g. during a deploy) without waiting for in-progress jobs to finish

// Wrong: abrupt exit, in-progress jobs left inconsistent process.on("SIGTERM", () => process.exit(0)); // Correct: waits for in-progress jobs to finish first process.on("SIGTERM", async () => { await worker.close(); process.exit(0); });

The Solution //

Terminating a worker process while it's actively processing a job can leave that job in a partially-completed, inconsistent state (e.g. an email marked as sent but never actually delivered). A graceful shutdown handler should stop accepting new jobs immediately but wait for any currently-processing job to finish before the process exits.

Continue Learning