#heavenly_hare_20907
1 messages · Page 1 of 1 (latest)
So, there are multiple objects accessing the Stripe Apis.
Hello! The solution is the guidance provided in the error you pasted above. Do you have a question about that guidance?
No, it's about multiple things trying to access the same object.
For example, if two things try to manipulate a Customer at the same time, we don't allow that. One of the things is allowed, the other gets the lock error you're seeing.
is there a way we can increase the rate limit in Stripe ?
This prevents simulatnious manipulations that can lead to unexpected results.
No, you need to adjust your approach.
What are you doing that's leading to this error?
Stripe::Customer.retrieve() while doing this operation seems like getting that error. I also need to check other endpoints
What are you doing immediately before calling that?
Actually i have found that in my server logs, I am assuming that might be the issue. But I am not 100% sure.
Also that issue is appearing in production server.
can we see from Stripe dashboard or logs which API call is exhausting their quota?
It's not about a quota.
You're not hitting an arbitrary limit, the issue is that what you're doing is resulting in more than one thing trying to access the same object at the same time, which is not allowed.
Usually the fix for this is to adjust the order of operations you're performing to prevent this from happening.
I am using the term quota, appropritate would be rate limit. Nevermind, i have gone through this documentation, I am reading the rate limits allowed by Stripe.
The highlighted portion there has nothing to do with the error you're experiencing.
This is the section that applies to the error you're seeing: https://stripe.com/docs/rate-limits#object-lock-timeouts
what you're doing is resulting in more than one thing trying to access the same object at the same time, which is not allowed
But if there are multiple users doing subscription let say, it can access same object multiple time right?
^ just an example usecase.
No, multiple users will have different Customer objects and different Subscription objects.
The issue is when the same Customer or Subscription or whatever is accessed at the same time.
Thanks for this documentation. This might be helpful
So, when Stripe webhook received (when invoice payment succeed with subscriptions and/or charge succeed with subscriptions), it's checking the Stripe::Customer.retrieve(). I think reason is: duplicate webhooks received from stripe or two different events webhooks received from Stripe and for all these cases we are checking Stripe::Customer.retrieve(). Either we need to recheck the logic or object log timeouts.
Ah, yeah, that sounds like it.