Architecture

Can your publishing agent retry after a timeout?

A CMS can publish an article and lose the reply. Here is how our site checks which revision went live before an editor or agent tries again.

Open Mercato
3 min read
Software is about to be built completely differently
Table of contents

A publishing agent sends the final draft to a CMS. The request times out. Should it press Publish again? If another editor has since corrected a price in the article, the answer depends on which revision the agent is holding.

We had to make that decision for the Open Mercato website. The site stores editorial content in EmDash. A publication takes effect in the running site without waiting for a deployment. That means an article can be live while the client that submitted it is still waiting for a reply.

What is the client asking to repeat?

Stripe gives clients a useful point of comparison. Suppose an integration asks Stripe to create a customer and loses the response. It can repeat the request using the same idempotency key. For its v1 API, once execution starts, Stripe saves the first response for that key. Changing the request parameters while reusing the key produces an error. The integration has to keep the key across attempts. Generating a fresh one on every retry defeats the mechanism. Stripe’s API contract

Publishing adds a wrinkle. Two editors can submit different versions of the same article at the same address. Opening the public URL and seeing a page there tells you very little. Yesterday’s copy would also return a perfectly good page.

How our site answers a second publish request

The Open Mercato website sends the entry ID and the revision the editor last read. Our publishing code keeps a record of the revision it validated. If the reply goes missing and the editor resends the original request, the site looks up the live revision and compares it with that record. When they match, it can acknowledge the publication. If the site cannot establish what happened, it returns an explicit unknown outcome so the client can reload the entry. EmDash’s revision-aware publishing tools

Consider the price correction. The agent submitted a draft saying $90. An editor subsequently published $95. The two versions share a slug and an entry ID. Checking the revision lets the client distinguish them. Its next step should be to show the editor the newer version. Automatically fetching that revision and resubmitting the old copy would throw away the protection the check provided.

This is a choice we made in the website repository. A team adopting the same approach owns the record of what it tried to publish and the check against what is live. It also owes the reader one more check. A CMS can acknowledge the right revision while the public page still shows an old price or a broken embed. For a tool page, try the actual operation: enter a SKU and generate its barcode. Try the Code 128 generator

At the next design review, give someone two browser windows and one disposable article. In staging, drop the response after the first publish commits. In the other window, change a sentence and publish it. Replay the first request. The test passes when the newer sentence is still visible and the first client can tell the operator exactly what it knows about its own revision.

Build fast. On foundations you can trust.

Start with 80% done.