From 3422f723143d9ea44f3e8fb1bc4a49ccc54273e3 Mon Sep 17 00:00:00 2001 From: Patrick Pfeiffer Date: Mon, 24 Jun 2024 12:25:48 +0200 Subject: [PATCH] (NOBIDS) remove unneeded retries in stripe-handler --- handlers/stripe.go | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/handlers/stripe.go b/handlers/stripe.go index 2838b79de0..1f15790ab4 100644 --- a/handlers/stripe.go +++ b/handlers/stripe.go @@ -474,23 +474,7 @@ func StripeWebhook(w http.ResponseWriter, r *http.Request) { } defer tx.Rollback() - // retry updating subs if webhooks come out of order - retries := 0 - for { - err = db.StripeUpdateSubscriptionStatus(tx, invoice.Lines.Data[0].Subscription, true, nil) - if err == nil { - break - } - if err.Error() == "no rows affected" { - retries++ - if retries > 3 { - break - } - time.Sleep(1000 * time.Millisecond) - continue - } - break - } + err = db.StripeUpdateSubscriptionStatus(tx, invoice.Lines.Data[0].Subscription, true, nil) if err != nil { logger.WithError(err).Error("error processing invoice failed to activate subscription for customer", invoice.Customer.ID) http.Error(w, "error processing invoice failed to activate subscription for customer", http.StatusInternalServerError)