This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch lyft-release-sp8
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/lyft-release-sp8 by this push:
new 59a81e1 Workaround for no results returned (#7442)
59a81e1 is described below
commit 59a81e105f8cdcecdc342936cf8b5babfce34697
Author: Beto Dealmeida <[email protected]>
AuthorDate: Fri May 3 14:25:36 2019 -0700
Workaround for no results returned (#7442)
---
superset/assets/src/SqlLab/components/QueryAutoRefresh.jsx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/superset/assets/src/SqlLab/components/QueryAutoRefresh.jsx
b/superset/assets/src/SqlLab/components/QueryAutoRefresh.jsx
index 541ce2d..13834cb 100644
--- a/superset/assets/src/SqlLab/components/QueryAutoRefresh.jsx
+++ b/superset/assets/src/SqlLab/components/QueryAutoRefresh.jsx
@@ -41,10 +41,18 @@ class QueryAutoRefresh extends React.PureComponent {
const { queries, queriesLastUpdate } = this.props;
const now = new Date().getTime();
+ // due to a race condition, queries can be marked as successful before the
+ // results key is set; this is a workaround until we fix the underlying
+ // problem
+ const isQueryRunning = q => (
+ ['running', 'started', 'pending', 'fetching'].indexOf(q.state) >= 0 ||
+ (q.state === 'success' && q.resultsKey === null)
+ );
+
return (
queriesLastUpdate > 0 &&
Object.values(queries).some(
- q => ['running', 'started', 'pending', 'fetching'].indexOf(q.state) >=
0 &&
+ q => isQueryRunning(q) &&
now - q.startDttm < MAX_QUERY_AGE_TO_POLL,
)
);