#sai_rez-object lock

1 messages · Page 1 of 1 (latest)

trail jungle
#

👋 happy to help

#

could you please share the request id that generated this error?

tired fog
#

There isn't one in particular, it's something we've noticed being flagged through sentry. Here is one from today for example
req_NXmpCgHwSqm0ZA

trail jungle
#

ok I will take a look

tired fog
#

Thanks!

trail jungle
#

sorry it's taking me some time to figure this out

#

but I'm trying to find a link

tired fog
#

No problem, do you need any more information for me?

#

This is the filter I applied to have find the errors

trail jungle
#

no I think I nailed it down, and I'm just trying to search in our logs to find more details, but I think you tried to change something about the payment method after creating a subscription involving that same payment method

tired fog
#

That's interesting, could you explain what changed in the payment method so I could better track it down in our flow

trail jungle
#

I think you were updating the billing_details

#

was that handled by your webhook?

tired fog
#

I'm not entirely sure I would have to review the flow

#

So what you observed was that there was a subscription created with a payment method and around the same time a request was sent to update the same payment method?

trail jungle
#

basically the request was this req_7BJlYkMd5T3Jg1 updating an existing subscription with a default payment method (the one that caused the lock) basically because when you add a payment method(PM) to a subscription we try to authenticate the PM and we lock the object while we're doing the auth. if you try to update the PM before the auth ends then it's normal to end up with a lockout

tired fog
#

I see, what's the best way to handle this, is there something we should be awaiting?

#

Would adding this to our code help
stripe.setMaxNetworkRetries(2);

trail jungle
#

to be honest, I'm not sure, I'd have to test it but I think that would be one way of handling the error

tired fog
#

Is there a general rule as to when the errors occurs, for e.g we have some for requests made to subscriptions, customers, setup_intents etc..?

misty sleet
#

Hey, taking over here. Let me catch-up!

tired fog
#

Yes I'm just trying to understand more about what causes it so we can adjust our flow properly

#

Tarzan, mentioned with add a PM to a subscription it becomes locked, does that happen with other calls for e.g. to subscriptions or customers?

misty sleet
#

I don't know an extensive list, but it's best to just assume that we could lock all objects during updates

tired fog
#

So would you say short term it's best to use setMaxNetworkRetries and long term implement a queue?

misty sleet
#

It depends on your integration, what APIs you're calling, volume of traffic, etc. But if you're running into lock_timeout errors we'd recommend implement network retries and seeing if that alleviates the issue (I suspect it will)

tired fog
#

Okay awesome, thanks for the information

misty sleet
#

np!