Skip to content

Commit

Permalink
[hotfix] using UTC for caching timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Apr 17, 2017
1 parent d6689ee commit 63785f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion superset/assets/javascripts/components/CachedLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CacheLabel extends React.PureComponent {
updateTooltipContent() {
const cachedText = this.props.cachedTimestamp ? (
<span>
Loaded data cached <b>{moment(this.props.cachedTimestamp).fromNow()}</b>
Loaded data cached <b>{moment.utc(this.props.cachedTimestamp).fromNow()}</b>
</span>) :
'Loaded from cache';

Expand Down
2 changes: 1 addition & 1 deletion superset/assets/javascripts/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def get_payload(self, force=False):
'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)
Expand Down

0 comments on commit 63785f0

Please sign in to comment.