mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-18 04:56:29 -06:00
Fix last_used=None error
This commit is contained in:
parent
5d868168a5
commit
d32bbd06cf
@ -20,8 +20,7 @@ class TokenAuthentication(authentication.TokenAuthentication):
|
|||||||
raise exceptions.AuthenticationFailed("Invalid token")
|
raise exceptions.AuthenticationFailed("Invalid token")
|
||||||
|
|
||||||
# Update last used, but only once a minute. This reduces the write load on the db
|
# Update last used, but only once a minute. This reduces the write load on the db
|
||||||
last_used_diff = timezone.now() - token.last_used
|
if not token.last_used or (timezone.now() - token.last_used).total_seconds() > 60:
|
||||||
if last_used_diff.total_seconds() > 60:
|
|
||||||
token.last_used = timezone.now()
|
token.last_used = timezone.now()
|
||||||
token.save()
|
token.save()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user