- Issue created by @ufku
Despite the lock mechanism it's still possible to create duplicate transactions.
Request-A creates the lock and after 30 seconds it is still in txn creation process(slow server), then comes request-B (31st second) with the same txn-id and passes the expired lock. Both create the same transaction.
The solution is to acquire the lock for the payment intent id(not the order id) for max_execution_time. This way no other request can create the same txn until the current one finishes. We also allow other txns to be created on the order by not locking the order.
Attached a patch for an old version of the module that we use in our site.
Needs review
1.0
Code