453
WishUnderflow (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] balsoft@lemmy.ml 4 points 3 days ago

You decrement the wish counter first, execute the action (which includes waiting those 5 days), and if it fails you increment the counter back. Something like this:

wishes = wishes - 1;
executeWish(wish).unwrap_or_else(|_| { wishes = wishes + 1; })?

This way if the action fails in the future, you get a wish back and can ask something else.

this post was submitted on 31 Jul 2025
453 points (100.0% liked)

Programmer Humor

25436 readers
885 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS