Hacker Newsnew | past | comments | ask | show | jobs | submit | achernik's commentslogin

> How should you store the key? I’ve seen people store it in some durable, resource-specific way (e.g. as a column on the comments table), but I don’t think that’s strictly necessary. The easiest way is to put them in Redis or some similar key/value store (with the idempotency key as the key).

I'm not sure how would storing a key in Redis achieve idempotency in all failure cases. What's the algorithm? Imagine a server handling the request is doing a conditional write (like SET key 1 NX), and sees that the key is already stored. What then, skip creating a comment? Can't assume that the comment had been created before, since the process could have been killed in-between storing the key in Redis and actually creating the comment in the database.

An attempt to store idempotency key needs to be atomically committed (and rolled back in case it's unsuccessful) together with the operation payload, i.e. it always has to be a resource-specific id. For all intents and purposes, the idempotency key is the ID of the operation (request) being executed, be it "comment creation" or "comment update".


Algorithm is that the key is changed everytime after result 200 from API or page is refreshed or changed to another.


Yes please don’t add another component to introduce idempotency, it will likely have weird abstraction leaking behavior or just be plain broken if you don’t understand delivery guarantees. Much better to support some kind of label or metadata with writes so a user can track progress on their end and store it alongside their existing data.


consider his another post in somewhat similar spirit: https://tigerbeetle.com/blog/2024-12-19-enum-of-arrays/ the author is indeed working in a performance-oriented niche


this would be a major breaking change


wasn’t the Carnation Revolution a direct result of the war in Angola?


Yes. A colonial war in three countries simultaneously, 2,000 miles from the nation.

Yet it still took 13 years, combined with the regime’s economic collapse and a shift in the educational background of the Armed Forces hierarchy to spark the revolution.

The US most likely will be in a civil war in eight to six months.... A cut in social security benefits will do it...


OMG such a bold assertion with no backing data…


Not at all, the reason the current administration is acting so cruelly is to bring people to despair. And desperate people do desperate things. A violent action will be used as excuse to deploy US armed forces against US citizens.

"Trump suggests he’ll use the military on ‘the enemy from within’ the U.S. if he’s reelected" - https://www.pbs.org/newshour/politics/trump-suggests-hell-us...

Democrats will dress in pink...

https://www.npr.org/2024/04/20/1246134779/the-reality-behind...

"In the near future, the U.S. president has given himself a third term. He's disbanded the FBI."

"Trump Muses About a Third Term, Over and Over Again" - https://www.nytimes.com/2025/02/10/us/politics/trump-third-t...


Like Putin did.


looks like they are "introducing" some internal component https://mobile.twitter.com/automattic/status/106436688085984...


Then what's the point? Low-key flex to try and attract talent?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: