Urgent.News

What's breaking now, across thousands of outlets.

Tech

Background jobs that survive a closed tab need more than a queue

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…

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.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Local Whisper transcription on a Windows PC: what hardware matters and how to check the output

We build ClapClip, a Windows app that runs Whisper models locally, so read this with that in mind. Most of the post is about checks, and they work the same if you run whisper.cpp from a terminal or…

  • ClapClip runs Whisper models locally on Windows for transcription
  • GPU recommended for faster processing, CPU works without issue
  • Output quality evaluated with WER on challenging five-minute audio

Tab Manager and Session Saver for Firefox: Save Your Tab Context Between Sessions

Tab overload is one of the most common browser complaints. The usual advice — bookmark everything, close ruthlessly — does not address the actual problem: some tabs are open because you are in the…

  • Tab Manager extension saves current tab context as separate sessions
  • Each session groups tabs linked to a specific task or context
  • Sessions can be restored with a single click to resume work

More from Tuesday 10 November →