mirror of
https://github.com/ansible/awx.git
synced 2026-04-14 06:29:25 -02:30
Bypass memcached to get last gather time to avoid reading cached values.
This commit is contained in:
@@ -338,9 +338,15 @@ def send_notifications(notification_list, job_id=None):
|
|||||||
|
|
||||||
@task()
|
@task()
|
||||||
def gather_analytics():
|
def gather_analytics():
|
||||||
|
from awx.conf.models import Setting
|
||||||
|
from rest_framework.fields import DateTimeField
|
||||||
if not settings.INSIGHTS_TRACKING_STATE:
|
if not settings.INSIGHTS_TRACKING_STATE:
|
||||||
return
|
return
|
||||||
last_time = settings.AUTOMATION_ANALYTICS_LAST_GATHER
|
last_gather = Setting.objects.filter(key='AUTOMATION_ANALYTICS_LAST_GATHER').first()
|
||||||
|
if last_gather:
|
||||||
|
last_time = DateTimeField().to_internal_value(last_gather.value)
|
||||||
|
else:
|
||||||
|
last_time = None
|
||||||
gather_time = now()
|
gather_time = now()
|
||||||
if not last_time or ((gather_time - last_time).total_seconds() > settings.AUTOMATION_ANALYTICS_GATHER_INTERVAL):
|
if not last_time or ((gather_time - last_time).total_seconds() > settings.AUTOMATION_ANALYTICS_GATHER_INTERVAL):
|
||||||
with advisory_lock('gather_analytics_lock', wait=False) as acquired:
|
with advisory_lock('gather_analytics_lock', wait=False) as acquired:
|
||||||
|
|||||||
Reference in New Issue
Block a user