#abuznego_invoiceitems-batch

1 messages ¡ Page 1 of 1 (latest)

cosmic pikeBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1243319765314043904

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

finite relic
#

Hi there! Taking a look

tame bolt
#

thank you!

#

we use the same idempotency key so that in retries, we don't add the same items when an invoice gets created

finite relic
#

Okay, I see another request to add an Invoice Item on the same Invoice was made at the exact same time: https://dashboard.stripe.com/logs/req_nymVhjjFG484FV

Because this other call to add an invoice item placed a lock on the Invoice, no other call can be made against this invoice until that first call is done/removes the lock

tame bolt
#

ok but then if we retry that same request, it will have the same idempotency key and thus return 429 even if there's no lock on it anymore?

finite relic
#

Right. If you retry the request and use the same idempotency key, you'll get the same result

#

If you still need to add this invoice item to the invoice, you should use a different idempotency key

tame bolt
#

ok and to avoid that error in the future

#

i see no way to configure the network retries

finite relic
#

You can add some logic on your end to avoid simultaneous requests on the same object and do these sequentially instead

tame bolt
#

we do them sequentially but it seems like it was done too quickly in between so planning to add some time in between each request

#

how often are events retried and for how long? for invoice created

finite relic
#

Retries for lock timeouts are only automatic if you use Stripe's libraries

tame bolt
#

but those are called in our system when an invoice is created. how often are those invoice.created events retried

finite relic
#

Ah, sorry, I missed your callout of events

#

In test mode, we retry three times over the course of a few hours

cosmic pikeBOT
tame bolt
#

ok got it. feels hacky to have to add time in between request when we're just going through a list of invoice items to add.

#

is there no way to add multiple invoice items at once

pallid kindle
#

no there isn't unfortunately

#

abuznego_invoiceitems-batch

tame bolt
#

ok thank you

pallid kindle
#

sure!

tame bolt
#

the invoice.created event will be retried up to 3 days but how often until then?

pallid kindle
#

there's no set time, it's all dynamic based on the health of your endpoint.