Better HN
topnewbestaskshowjobs
Log inSign up

achernik

14 karma · joined Aug 16, 2016 (10y ago) · 6 submissions

Submissions

comment 3mo ago · link · parent

this used to be the case in Rails, but hasn't been for at least a year. Nowadays each framework-controlled action (like record.save) checks out a connection and then returns it back; this was implemented as part of the whole "run rails in fiber-based server" push

comment 1y ago · link · parent

> 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".

comment 1y ago · link · parent

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

comment 1y ago · link · parent

this would be a major breaking change

comment 1y ago · link · parent

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

comment 7y ago · link · parent

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