Put user last accessed updating behind a feature flag
This commit is contained in:
parent
a6b5b4d6e3
commit
4ba4d9141b
5 changed files with 22 additions and 4 deletions
|
@ -162,6 +162,9 @@ def calculate_image_aggregate_size(ancestors_str, image_size, parent_image):
|
|||
def update_last_accessed(token_or_user):
|
||||
""" Updates the `last_accessed` field on the given token or user. If the existing field's value
|
||||
is within the configured threshold, the update is skipped. """
|
||||
if not config.app_config.get('FEATURE_USER_LAST_ACCESSED'):
|
||||
return
|
||||
|
||||
threshold = timedelta(seconds=config.app_config.get('LAST_ACCESSED_UPDATE_THRESHOLD_S', 120))
|
||||
if (token_or_user.last_accessed is not None and
|
||||
datetime.utcnow() - token_or_user.last_accessed < threshold):
|
||||
|
|
Reference in a new issue