Alexander Belanger Co-Founder Hatchet
After reading Caity Weaver’s “I Found It: The Best Free Restaurant Bread in America”—a hero’s journey that starts with a rather simple question, posed at a local favorite restaurant, and ends with considerations of bread’s place in American culture—I realized two things. First, that I, too, greatly value a restaurant’s offering of free bread. Second, she and I share an interest in exploring seemingly trivial and impossible questions, such as is this the best free restaurant bread in America?
As a software engineer, I often find myself wondering if the thing I’m looking at is the first instance of that thing. In other words, is this thing—usually a feature, product or platform—truly novel?
So as I was drafting up a post about our latest feature, idempotency keys, I set out to answer one such question: what was the first instance of an idempotency key?
Idempotency keys are unique identifiers that allow API handlers or downstream consumers to de-duplicate messages that have been delivered more than once. If the handler has seen that string before, it’ll ignore the message.
Consider my dog, Ringo (this is going somewhere, I promise). Ringo really likes his kibble (shoutout to Purina Pro Plan 30/20 Sport), so much so that exactly at 6pm, he’ll wake up from a coma-like slumber, grab his slow feeder bowl, and drop it at my feet.
Ringo’s a sneaky bastard. He’ll get his dinner from me, and then amble into the adjacent room to beg his (non-biological) mother for more food. He knows that she doesn’t know he’s already been fed. On more than one occasion, he’s gotten double dinner.
If my wife and I were a web server, we’d store an idempotency key to record the first instance of the meal. Instead we resort to yelling “I’M FEEDING RINGO” two times a day.
Ringo with his pizza toy after being denied a second dinner.
(For a deeper dive on how to implement a system like this on an actual web server, I’m a fan of this post.)
... continue reading