You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ju...@apache.org on 2023/06/29 21:06:20 UTC

[superset] branch master updated: fix(sqllab): Add threshold for checking inactive queries (#24536)

This is an automated email from the ASF dual-hosted git repository.

justinpark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 8ba0b81957 fix(sqllab): Add threshold for checking inactive queries (#24536)
8ba0b81957 is described below

commit 8ba0b81957121fc4873fcf1ad9eea343dec31c4c
Author: JUST.in DO IT <ju...@airbnb.com>
AuthorDate: Thu Jun 29 14:06:12 2023 -0700

    fix(sqllab): Add threshold for checking inactive queries (#24536)
    
    Co-authored-by: Justin Park <ju...@apache.org>
---
 superset-frontend/src/SqlLab/actions/sqlLab.js                     | 4 ++--
 superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx | 4 ++--
 superset-frontend/src/SqlLab/reducers/sqlLab.js                    | 1 +
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js b/superset-frontend/src/SqlLab/actions/sqlLab.js
index addad284e7..886307ad3e 100644
--- a/superset-frontend/src/SqlLab/actions/sqlLab.js
+++ b/superset-frontend/src/SqlLab/actions/sqlLab.js
@@ -201,8 +201,8 @@ export function estimateQueryCost(queryEditor) {
   };
 }
 
-export function clearInactiveQueries() {
-  return { type: CLEAR_INACTIVE_QUERIES };
+export function clearInactiveQueries(interval) {
+  return { type: CLEAR_INACTIVE_QUERIES, interval };
 }
 
 export function startQuery(query) {
diff --git a/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx b/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx
index 65a6d11a1d..d8975e520c 100644
--- a/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx
+++ b/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx
@@ -92,7 +92,7 @@ function QueryAutoRefresh({
                 }, {}) ?? {};
               dispatch(refreshQueries(queries));
             } else {
-              dispatch(clearInactiveQueries());
+              dispatch(clearInactiveQueries(QUERY_UPDATE_FREQ));
             }
           }
         })
@@ -102,7 +102,7 @@ function QueryAutoRefresh({
         });
     }
     if (!cleanInactiveRequestRef.current && !shouldRequestChecking) {
-      dispatch(clearInactiveQueries());
+      dispatch(clearInactiveQueries(QUERY_UPDATE_FREQ));
       cleanInactiveRequestRef.current = true;
     }
   };
diff --git a/superset-frontend/src/SqlLab/reducers/sqlLab.js b/superset-frontend/src/SqlLab/reducers/sqlLab.js
index fae868df1c..9f92372fd2 100644
--- a/superset-frontend/src/SqlLab/reducers/sqlLab.js
+++ b/superset-frontend/src/SqlLab/reducers/sqlLab.js
@@ -647,6 +647,7 @@ export default function sqlLabReducer(state = {}, action) {
         Object.entries(queries).filter(([, query]) => {
           if (
             ['running', 'pending'].includes(query.state) &&
+            Date.now() - query.startDttm > action.interval &&
             query.progress === 0
           ) {
             return false;