Skip to content
anythingai.space
Backend for AIintermediate11 min · 10 steps

Background Jobs

Run scheduled, triggered and handed-off work outside the request–response cycle, with explicit states, retries, timeouts and enough visibility that failures never go silent.

fails silentlystale chunksTWO RUNS OVERLAPMonday runstill running…Tuesday runstarts anywaytime →cron on one VMre-index.shKnowledge index3 weeks staleUsergets old answers
errordatarequestheavy worksignalresponse
1 / 10
ProblemStep 1 of 10

The nightly script nobody is watching

The knowledge base is re-indexed by a cron script on one VM. One night it runs long and the next run overlaps it. Another week the source credentials expire and it fails silently: the assistant quietly answers from stale articles for weeks.

Background work needs what request handlers get for free: someone notices when it fails.

Lesson 13 of 20 in Backend for AI