locking to prevent creation of multiple stripe customers for a single user #857
-
I ran into an issue where two simultaneous requests caused two stripe customers to be created for a single user. Seems like a classic multi-threading race condition in this method: https://github.com/pay-rails/pay/blob/39218494751fc021e1df89c14bcbd8812f962945/lib/pay/stripe/billable.rb#L51C1-L57C12 Example:
Do you think solving this (with some locking mechanism) should be the responsibility of the pay gem library or the application? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@mpvosseller yeah, that could definitely happen here. It would probably be wise to add a lock for all payment processors in these methods. 👍 |
Beta Was this translation helpful? Give feedback.
@mpvosseller yeah, that could definitely happen here. It would probably be wise to add a lock for all payment processors in these methods. 👍