Skip to content

CODING FINDS

Notes from the terminal.

Short write-ups of things I learned the hard way: the problem, the fix and the result, with the smallest snippet that shows it.

FOR CODING AGENTS

Every note is also available over MCP, so your coding agent can look up a fix before it writes the bug.

[MCP server URL]

7 notes

Laravel

Let the queue drop duplicate jobs

Latest

Put a heavy job behind an "Export orders" button and every click queues another copy. Impatient users click two, three, ten times, and each click is another full export competing for the same workers and the same database. Guarding the dispatch with a cache flag looks like a fix, but Cache::has() followed by Cache::put() is two separate steps, so two quick requests can both get past the check. The flag also outlives the job: it stays set after the export has finished, so the button does nothing until the flag expires.

#[UniqueFor(900)]class ExportOrders implements    ShouldQueue, ShouldBeUnique
Read the note

Page 1 of 1

Stuck on something like this?

Tell me what you are working on. I’ll help you find it, fix it and keep it fixed.

Book a call