From 63785f039c0f7763c410c9e7a40a0d477b9bf23a Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 17 Apr 2017 16:45:50 +0000 Subject: [PATCH] [hotfix] using UTC for caching timestamps --- superset/assets/javascripts/components/CachedLabel.jsx | 2 +- superset/assets/javascripts/dashboard/Dashboard.jsx | 2 +- superset/viz.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/assets/javascripts/components/CachedLabel.jsx b/superset/assets/javascripts/components/CachedLabel.jsx index e649fad3b2..4c1995b8a1 100644 --- a/superset/assets/javascripts/components/CachedLabel.jsx +++ b/superset/assets/javascripts/components/CachedLabel.jsx @@ -21,7 +21,7 @@ class CacheLabel extends React.PureComponent { updateTooltipContent() { const cachedText = this.props.cachedTimestamp ? ( - Loaded data cached {moment(this.props.cachedTimestamp).fromNow()} + Loaded data cached {moment.utc(this.props.cachedTimestamp).fromNow()} ) : 'Loaded from cache'; diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx b/superset/assets/javascripts/dashboard/Dashboard.jsx index 59e8e8874e..2910324cd6 100644 --- a/superset/assets/javascripts/dashboard/Dashboard.jsx +++ b/superset/assets/javascripts/dashboard/Dashboard.jsx @@ -144,7 +144,7 @@ export function dashboardContainer(dashboard, datasources) { done(slice) { const refresh = slice.getWidgetHeader().find('.refresh'); const data = slice.data; - const cachedWhen = moment(data.cached_dttm).fromNow(); + const cachedWhen = moment.utc(data.cached_dttm).fromNow(); if (data !== undefined && data.is_cached) { refresh .addClass('danger') diff --git a/superset/viz.py b/superset/viz.py index e244df41fe..608e98a4d2 100755 --- a/superset/viz.py +++ b/superset/viz.py @@ -250,7 +250,7 @@ class BaseViz(object): 'status': self.status, 'stacktrace': stacktrace, } - payload['cached_dttm'] = datetime.now().isoformat().split('.')[0] + payload['cached_dttm'] = datetime.utcnow().isoformat().split('.')[0] logging.info("Caching for the next {} seconds".format( cache_timeout)) data = self.json_dumps(payload)