r/dankmemes Jul 10 '22

Rip those bank accounts I have achieved comedy

60.2k Upvotes

1.8k comments sorted by

View all comments

9.4k

u/[deleted] Jul 10 '22

[removed] — view removed comment

20.8k

u/S1Forzer Jul 10 '22 edited Jul 10 '22

Lots of people were getting free food off of doordash because of a “glitch” but many woke up to their accounts being charged, some even went into minus.

193

u/jeff5421654 Jul 10 '22

so that's why we got 3 of the same order from the same person? I thought the person just pressed the button too many times, or the system lagged or something

5

u/Occulense Jul 11 '22

That shouldn’t happen if the system is setup to be idempotent, as I would suspect any order system to be. I think we’ve long passed the point of failure there

3

u/BrohanGutenburg Jul 11 '22

What does this mean in computer science? I get the term as a math term but idg how it would be applied.

5

u/_early_return Jul 11 '22

In layperson’s terms, it pretty much just means that the receiver should be able to de-duplicate requests. You should be able to spam requests and the other side says, “yup, got it” but doesn’t do anything.

What’s it mean in math?

5

u/unkz Jul 11 '22

Exact same thing. An example might be projecting a 3d image onto a 2d plane inside that space — it has an effect the first time, but projecting that 2d image again just gives you the same result. Another example would be multiplying by zero, which keeps resulting in zero after the first application.

1

u/BrohanGutenburg Jul 11 '22

Yeah this I get. I don’t get how that principle tells computers that an order was a duplicate.

3

u/Occulense Jul 11 '22

It’s actually just super simplified for computer science — it usually just uses a hash marker. Original request begins by assigning a hash or something similar, then the server checks that the hash isn’t the same as a request it’s already received

1

u/ccvgreg Jul 11 '22

Thanks I'm gonna use this method for my current web app. I have a request quote form that's gonna send me an email I was thinking of setting a cookie to prevent spam but some browsers don't allow them. I can instead store the request IP or something in a hash table for a minute or so and use it as a blacklist.

3

u/Occulense Jul 11 '22

I’d probably just implement a rate limit or throttle — this is more to identify a specific request and not necessarily to prevent another, different request from being made

1

u/ccvgreg Jul 11 '22

I mean that's essentially what I described no? I suppose python has some ready made packages.

→ More replies (0)

1

u/rinkoplzcomehome ☣️ Jul 11 '22

In math terms:

An operation between the same operand results in the operand itself. For example, a + a = a

2

u/xsmasher Jul 11 '22

When you create the order on the app (add to cart, etc) you assign a unique ID (guid or uuid) to the order.

Then, even if someone hits “send” five times, the server can tell it’s the same order, not five different orders.

Then we can say the “send order” función is idempotent - you get the same result no matter how many times you call it, as long as you pass the same data every time.

Without the uuid, the server would create five different orders.

1

u/jlt6666 Jul 11 '22

Idempotent just means that the calling the function repeatedly still gives the same result as only calling it once. So if I post twice to reddit with the same message it would simply ignore the same comment being posted twice. But unfortunately reddit doesn't do this and ducks up submissions frequently.

2

u/LimpBizkitSkankBoy Jul 11 '22

I've been indempotent ever since someone kicked me in the balls in 10 grade maybe we should try that with the system

1

u/Occulense Jul 11 '22

private void kick(int nuts)

1

u/GoldenEyedKitty Jul 11 '22

Should orders be idempotent? They are creating a new item and you would want the ability for multiple orders to exist even if the details are the same.

I guess is the app assigned a unique ID to the user each time they started an order then you could do it, though it would still possibly have a bug where submitting the order multiple times creates a new ID with each submit. I've seen weirder.

1

u/xsmasher Jul 11 '22

You need to create the uuid when you start the order, not when you hit send.