mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
billing: Add comment explaining race condition in customer creation.
This commit is contained in:
@@ -138,6 +138,10 @@ def extract_current_subscription(stripe_customer: stripe.Customer) -> Any:
|
||||
@catch_stripe_errors
|
||||
def do_create_customer_with_payment_source(user: UserProfile, stripe_token: str) -> stripe.Customer:
|
||||
realm = user.realm
|
||||
# We could do a better job of handling race conditions here, but if two
|
||||
# people from a realm try to upgrade at exactly the same time, the main
|
||||
# bad thing that will happen is that we will create an extra stripe
|
||||
# customer that we can delete or ignore.
|
||||
stripe_customer = stripe.Customer.create(
|
||||
description="%s (%s)" % (realm.string_id, realm.name),
|
||||
email=user.email,
|
||||
|
Reference in New Issue
Block a user