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;