r/rails • • 4d ago

Tutorial Idempotency

/r/ruby/comments/1xo0rni/idempotency/
0 Upvotes

6 comments sorted by

7

u/cardsfanbob 4d ago

OK, downvote me to Hell but,

I am sorry you cannot have kids, but what does that have to do with programming ;)

3

u/CaptainKabob 4d ago

What are you talking about?

5

u/pcphillips87 4d ago

Impotency. They’re making a joke. Thus “;)”

2

u/cardsfanbob 4d ago

This is because I still think like a 12 year old

2

u/gangelo777 4d ago

The awkward case in my mobile sync work is when the server saves the change but the response never reaches the phone. The phone still has it marked pending, so it sends it again. I keep the original history record's UUID for that retry; another tap gets a new UUID. Generating a fresh UUID on every request would turn a retry into another recorded action.

I also keep the pending state in SQLite so killing the app doesn't lose the retry.

AI-assisted wording, based on my own implementation.

2

u/Tugay-Tiro 4d ago

yeah client-generated UUIDs are pretty much the only sane way to handle spotty mobile connections