Build1 distinct publisher3 min readPublished
A dev.to write-up hands cron the question of when a job becomes eligible and hands a leased queue claim the question of how long it runs, and the interesting part is the second dedupe boundary that stops a committed report from being emailed twice.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
The line worth reading twice sits inside the heartbeat goroutine, where the return value of `Extend` is assigned to the blank identifier and dropped [8]. Nothing in the running job learns that its lease is gone. The worker keeps generating the report, and the loss only surfaces later, when `Complete` fails and the code wraps the error as `ErrLeaseLost` [11]. The blank identifier is carrying a lot of load there.
Cost out the two constants and you can see how much slack that leaves. The claim takes a two-minute lease; the ticker fires every 45 seconds [8]. Claim at t=0 and the lease expires at t=120. A tick that fails at 45 is survivable, because the tick at 90 renews with 30 seconds to spare. Two consecutive failures are not: the lease dies at 120 and the next attempt arrives at 135, fifteen seconds late [15]. One transient error against the lease store gets absorbed. Two in a row hand the occurrence to a second worker while the first is still writing.
That is why `WriteOnce` has to be a separate interface rather than a comment in the worker [10]. The failure order that matters is commit-then-die: the report store commits, the process terminates before acknowledging the message, the queue redelivers, and the second attempt must observe the committed report instead of publishing or emailing it again [10]. Deduplicating the trigger does nothing for that, because both deliveries are the same logical run.
The retry path has a ceiling I would raise. Delay is `1<<min(attempt,6)` seconds [9], so it doubles up to 64 seconds and the first seven attempts consume 127 seconds in total [16]. If the upstream a report depends on is down for an hour, a 64-second cap means roughly 56 wake-ups in that hour [18], each one claiming a lease and failing. Fine for a flaky S3 call. Wasteful against a dependency with a maintenance window.
The 15 minutes is a claim about someone else's platform [1], and the author is explicit that the portable part is the envelope and the claim protocol rather than any SDK [6]. For the pattern to transfer you need exactly two primitives underneath it: an insert that is atomic on the occurrence key, so a doubled trigger loses the race instead of starting a second run [4], and a lease you can extend by key and lease ID from inside the worker [6]. A unique index and an `UPDATE ... WHERE lease_id = $1` will do both. A queue that offers only a fixed, unextendable visibility timeout will not, whatever its docs call the timeout.
In my context this is the right trade, and the reason is scope rather than throughput: the trigger shrinks to something you can read in one sitting [3], and the job's progress becomes a row you can query instead of a log line you have to interpret. The one change I would make before shipping it is to have a failed `Extend` cancel the job context, so the first worker stops on its own rather than discovering the problem at `Complete` [8][11].
Ranked by verification strength, evidence, and original report placement.
The pattern is presented as applying to a Node.js service even though the sample is Go, with the important contract being the message envelope and claim protocol rather than an SDK; the Queue interface exposes EnqueueOnce, Claim, Extend, Complete and Retry, and the Reporter interface exposes WriteOnce.
The author reports being paged by missed jobs and duplicate deliveries, and says a runbook beginning with "check the cron process" was too shallow: the useful questions are whether the occurrence was recorded, whether it was published, whether a worker claimed it, and whether the side effect committed, which are four different states.
In the sample WorkOne function, Claim takes a two-minute lease and a goroutine ticker calls Extend for another two minutes every 45 seconds, with the return value of Extend discarded via the blank identifier.
The example has two safeguards: EnqueueOnce deduplicates the scheduled occurrence and WriteOnce deduplicates the external effect. Both are needed because a worker can finish writing a report and terminate before acknowledging the queue message, and the next delivery must observe the already committed report rather than emailing or publishing it again.
The post recommends letting a cron trigger enqueue a small, idempotent job record, then letting queue workers claim that record and run the long cleanup or report outside the scheduler's 15-minute limit.
The post states: "The deciding constraint is ownership of execution time. A scheduler should own when a job becomes eligible, not the entire lifetime of the job."
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 28, 2026
Follow any of these and your For You feed starts watching them — no settings page required.
build
OpenAI-compatible image APIs normalize transport, not fallback routing1 distinct publisher
build
A Timed-Out Reset SMS Is Not A Failed One, And Your Retry Code Probably Disagrees1 distinct publisher
build
Retry budgets are sized against outages, not jitter: 45 seconds lost all sixteen clips1 distinct publisher
build
A recorded cutoff and an operation key make the second delete delivery a no-op1 distinct publisher
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Inspectable code, uncheckable outcomes
The specifics hold up because they are quotable: the key format, the five queue methods, the two-minute lease, the shift-based backoff are all right there in dev.to's listing, and the arithmetic around them checks out. What has no support is the part that matters operationally — the pages that motivated the design are described without a service, a date, or a number, and no test, trace, or failure injection demonstrates the protocol actually closes the windows it claims to close.
Nobody on record running it
No team, service, queue product, or deployment appears anywhere in this reporting. The author's unnamed pages are a reason he wrote the pattern down, not evidence that anyone is using it, and there is no release, benchmark, or usage disclosure to weigh.
Sold quietly, sharper than it looks
The pitch is unusually restrained — no benchmark, no vendor, an explicit admission that the sample heartbeat needs production hardening. The overreach is small and local: "One record. One owner." reads as settled, while the code beneath it throws away Extend's error and leaves a permanently failing job retrying about 56 times an hour with no attempt cap. The claim isn't inflated so much as tidier than its own sample.
Nothing for sale but the byline
Follow the money and it stops immediately: no product, no SDK, no managed queue, and a sample written against bare interfaces so it commits the reader to nothing. What remains is the ordinary pull of publishing on a developer platform — a Node.js headline over a Go listing, and an ending that stops mid-sentence, both of which suggest audience and cadence mattered more than finishing the argument.
Sure what it says, unsure it works
We can stand behind almost every particular in this story because the post is its own primary document and we read it directly. We can stand behind none of the payoff: a single author, no corroborating account, no evidence of the pattern surviving contact with a real queue, and a text that breaks off before it lands.