Skip to content
>devspeak
← glossary
level 7Architecture

Background job

also: background jobs, background task, background tasks

A task your app does behind the scenes, separately from what the user is waiting on, like sending a receipt email after checkout.

a bit more technical

Work run outside the request and response cycle, either triggered by an event (send a welcome email after signup) or on a schedule (a nightly report). Jobs are usually placed on a queue and run by a worker, so slow work doesn't block the user.

picture it

A hotel guest checks in and heads to their room. Meanwhile, housekeeping restocks the minibar. The guest never waited at the desk for that to happen.

why it matters

Moving slow work into background jobs makes apps feel fast. But the user's action "succeeds" before the job finishes, so you need a plan for when the job fails.

what your agent might say
agent
Generating the PDF invoice takes about 8 seconds, so I moved it to a background job. The user sees 'Your invoice is being prepared' and gets an email when it's ready.
how you might use it
you → your agent
Move the weekly summary email into a background job that runs every Monday at 8am. Log each run and alert me if it fails.
common mistake

Assuming background jobs always finish. They can fail, time out or never start, and nobody sees an error on screen.

builds on