Job Queue
noun
say it: “JAHB KYOO” /dʒɑb kju/
A waiting line of tasks that a program works through one by one, after it has answered the request that asked for them.
What is a job queue?
A job queue is a line of work waiting to run after the response has gone, one job after another. An in-memory queue is fine for work that can be redone; a job service such as BullMQ keeps jobs safe through a restart.
const jobs = [];
app.post("/photos", (req, res) => {
jobs.push({ photoId: req.body.id, task: "make-thumbnail" });
res.status(202).json({ status: "queued" });
});
// a worker takes jobs from the front, one at a time
In a sentence
- “Because the job queue lived in memory, the jobs waiting when the server restarted were lost.”
- “Uploads answer at once; the thumbnails wait in a job queue and are made a second later.”
Level: Journeyman · More Node.js terms at this level
Updated