#heavenly_hare_20907

1 messages · Page 1 of 1 (latest)

sturdy harborBOT
solemn wind
#

So, there are multiple objects accessing the Stripe Apis.

autumn ether
#

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.

solemn wind
#

is there a way we can increase the rate limit in Stripe ?

autumn ether
#

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?

solemn wind
#

Stripe::Customer.retrieve() while doing this operation seems like getting that error. I also need to check other endpoints

autumn ether
#

What are you doing immediately before calling that?

solemn wind
#

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?

autumn ether
#

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.

solemn wind
#

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.

autumn ether
#

The highlighted portion there has nothing to do with the error you're experiencing.

solemn wind
#

^ just an example usecase.

autumn ether
#

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.

solemn wind
solemn wind
#

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.

autumn ether
#

Ah, yeah, that sounds like it.