{
  "id": 19264578,
  "title": "Background jobs that survive a closed tab need more than a queue",
  "url": "https://urgent.news/2026/11/10/background-jobs-that-survive-a-closed-tab-need-more-than-a-queue",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-10T02:00:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/teasateam/background-jobs-that-survive-a-closed-tab-need-more-than-a-queue-b8d"
  },
  "original_language": "en",
  "account": "Browsers can abruptly stop monitoring background tasks when a tab is closed, a phone loses connectivity, or a user signs out. This interdependence between the workflow and browser poses challenges. Granting a job an identity and tracking its progress enables recovery. However, failures may occur during the process of accepting the job and enqueuing it. Data corruption or loss can happen if a worker is terminated midway through a task, or if an outdated worker writes to data after a newer worker takes over. To mitigate these issues, admission to a job should occur before confirming its acknowledgment. A unique identifier and an initial set of tasks should be stored durably. A status URL should be provided after the commit, with 202 Accepted indicating that the processing has been accepted, but not guaranteeing successful completion. The status resource should reflect various states such as queued, running, retrying, completed, cancelled, and needing attention. Each status read requires authorization, but knowing a job ID should not grant access to another person's input or output. To address the gap between commit and enqueue, a transactional outbox or a recovery scanner can be employed. These solutions must be resilient to duplicate deliveries. A lease system can be implemented to enable work movement, while a fence can prevent stale writes. A worker is given a limited time to complete a task using a lease. If the lease expires, another worker can claim it. By checking the fence, the system can determine which worker currently owns the result. The provided Python script demonstrates how a replaced worker cannot overwrite the current result.",
  "summary": "A browser can stop polling at any moment: its tab closes, the phone goes offline, or the user signs out. If the browser also owns the workflow, the work stops with it. A durable job changes that relationship. The client asks the server to accept work, receives an identity, and later observes progress. Closing the screen stops observation, not the accepted job. The tricky failures occur between…",
  "key_points": [
    "Background jobs can fail when a tab closes or connectivity drops.",
    "Unique identifier and initial tasks must be stored durably.",
    "Transactional outbox or recovery scanner can address commit-enqueue gap."
  ],
  "editors_take": "Moving beyond simple queues toward durable identity and lease systems transforms background processing from a fragile browser-dependent workflow into a resilient architecture capable of surviving abrupt terminations and data corruption.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}