HNHacker News
TopNewBestAskShowJobs

achernik

14 karma · joined August 16, 2016

submissionscomments
achernik··on Solid Queue 1.6.0 now supports fiber workers
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
achernik··on Everything I know about good API design
> 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".

achernik··on Push Ifs Up and Fors Down
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
achernik··on Ruby 3.5 Feature: Namespace on read
this would be a major breaking change
achernik··on US Ends Support For Ukrainian F-16s
wasn’t the Carnation Revolution a direct result of the war in Angola?
achernik··on Building Thousands of Reproducible ML Models with pipe
looks like they are "introducing" some internal component https://mobile.twitter.com/automattic/status/106436688085984...