Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auth_saml: Add FOR UPDATE NOWAIT clause to SAML provider query
- Enhance concurrency handling when fetching SAML provider data - Prevent potential deadlocks by using NOWAIT - Ensure data consistency during high-traffic scenarios Previous attempt using the locking mechanisms self.env.cr.execute( "SELECT id FROM auth_saml_provider WHERE id in %s FOR UPDATE", (tuple(provider_ids),), ) led to increased latency and deadlocks under high load. We experienced race conditions where two simultaneous login attempts triggered parallel updates of the idp_metadata, leading to unreleased locks. The FOR UPDATE NOWAIT clause addresses this issue by: 1. Acquiring an exclusive lock on the row being updated 2. Failing fast if the lock cannot be acquired (NOWAIT) 3. Ensuring that only one transaction can update the idp_metadata at a time
- Loading branch information