Skip to content

Commit

Permalink
auth_saml: Add FOR UPDATE NOWAIT clause to SAML provider query
Browse files Browse the repository at this point in the history
- Enhance concurrency handling when fetching SAML provider data
- Prevent potential deadlocks by using NOWAIT
- Ensure data consistency during high-traffic scenarios
  • Loading branch information
Ricardoalso committed Oct 17, 2024
1 parent 1219cbb commit 81014f5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions auth_saml/models/auth_saml_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ def _validate_auth_response(self, token: str, base_url: str = None):
except SignatureError:
# we have a metadata url: try to refresh the metadata document
if self.idp_metadata_url:
self.env.cr.execute(

Check warning on line 311 in auth_saml/models/auth_saml_provider.py

View check run for this annotation

Codecov / codecov/patch

auth_saml/models/auth_saml_provider.py#L311

Added line #L311 was not covered by tests
"SELECT id, idp_metadata from auth_saml_provider FOR UPDATE NOWAIT"
)
self.action_refresh_metadata_from_url()
# retry: if it fails again, we let the exception flow
client = self._get_client_for_provider(base_url)
Expand Down

0 comments on commit 81014f5

Please sign in to comment.