mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #4695 from ryanpetrello/oauth-token-exclusive-lock
move the oauth2 last_used update to the bottom of the request Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
eaf3a28d57
@ -3,7 +3,7 @@ import re
|
||||
|
||||
# Django
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models
|
||||
from django.db import models, connection
|
||||
from django.utils.timezone import now
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf import settings
|
||||
@ -121,7 +121,7 @@ class OAuth2AccessToken(AbstractAccessToken):
|
||||
valid = super(OAuth2AccessToken, self).is_valid(scopes)
|
||||
if valid:
|
||||
self.last_used = now()
|
||||
self.save(update_fields=['last_used'])
|
||||
connection.on_commit(lambda: self.save(update_fields=['last_used']))
|
||||
return valid
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user