Urgent.News

What's breaking now, across thousands of outlets.

Tech

48-Hour Field Notes: A Crash Mid-Batch Proved My Queue Had No Memory

My batch job had a very confident opinion about progress, and that opinion lived entirely in a Python variable. If the process died, the variable died with it, and the next run started from zero like nothing had ever happened. Sound familiar? I spent a 48-hour window on this instead of shipping the feature I actually wanted to ship. Here is the thing that annoyed me most: my earlier fix was…

In the midst of a crash during a batch job, an issue emerged where the queue had no memory of previously claimed items that had not yet been completed. The Python variable responsible for tracking progress died along with the process, causing subsequent runs to start from scratch. Inspecting the code, it became clear that the earlier fix, which involved idempotency-hashing inputs, did not address the problem of missing items due to crashes.

To resolve this, a journal was created to survive sudden terminations and keep track of which items were claimed, completed, or stranded.

The challenge was to handle the window between claiming an item and committing the outcome. This gap was where queues lost data, and it was where the first version of the code had lost a pending item permanently. To tackle this, a lease system was implemented, with a monotone clock check and the rule that a claim expires after a certain period.

By introducing four states (pending → claimed → done | failed) and carrying lease information in the claimed rows, the issue of unrecoverable states was transformed into a recoverable one.

The solution was implemented in a runner.py script using SQLite on purpose for its simplicity - a single file that can be easily copied and inspected. The script includes functions for connecting to the database, initializing the work and ledger tables, claiming the next item, and finishing the job with an outcome. By enforcing a lease expiration, the system ensures that no data is lost even in the event of a crash, allowing workers to safely pick up items and making the entire process more robust and reliable.

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

Assume Nothing Persists: Five Free-Tier Myths and a Restart Drill You Can Re-Run

Free compute is easy to start and easy to misread. Your demo works on Friday afternoon. Do you know it works on Monday morning? Here is one reframe that kills most of these myths at once.

  • Free tiers provide temporary access, not permanent servers
  • Data stored locally can be lost; categorize data wisely
  • Health checks must test both liveness and readiness

O agente não precisa pensar em voz alta

Hybrid Reasoning Agents combinam raciocínio latente com ações em texto - e forçam a separar eficiência, observabilidade e validação. Agentes de LLM ainda raciocinam e agem quase só em texto.

  • Hybrid Reasoning Agents combine latent reasoning with text-based actions
  • HybridLink manages transition between latent and text modes
  • Agents achieve 10.4% performance improvement over text-based agents

Time Magazine Profiles John Ternus

Andrew Chow, writing for Time: Just below the broad smile he’s been wearing all morning, John Ternus’ hands are shaking. On this September day in Silicon Valley, Apple’s new CEO is surrounded by…

More from Monday 19 October →