Losing the race to store identical content is not a failed save

FixDocsService
Shipped
September 9, 2026 at 8:11 PM UTC
Author
Kamo
Commit
9c85179

The look-up before the ImgDat insert is not a lock, and kamowsdocs runs two replicas behind one gateway — two documents whose bytes are identical (two members creating the same blank spreadsheet in the same second) can both find nothing and both insert. The loser gets the 23505 that this whole path exists to stop returning to the editor as "Document cannot be saved, please check your permissions". A conflict on idx_img_dats_hash_unique means the content IS stored, by whoever got there first, so that row is the answer. The recovery read is by BLAKE3 alone because findByHashCombination matches only published rows and the row that just beat us may still be mid-upload on the other pod — it collides all the same, so it has to be findable. A conflict on any other constraint is still a failure.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing