Skip to content

Commit

Permalink
(NOBIDS) remove unneeded retries in stripe-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
guybrush committed Jun 24, 2024
1 parent d6a1bd0 commit 3422f72
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions handlers/stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3422f72

Please sign in to comment.