Skip to content

Commit

Permalink
fix(sqllab): Add threshold for checking inactive queries (#24536)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Park <justinpark@apache.org>
  • Loading branch information
justinpark and Justin Park authored Jun 29, 2023
1 parent 19deb91 commit 8ba0b81
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions superset-frontend/src/SqlLab/actions/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function QueryAutoRefresh({
}, {}) ?? {};
dispatch(refreshQueries(queries));
} else {
dispatch(clearInactiveQueries());
dispatch(clearInactiveQueries(QUERY_UPDATE_FREQ));
}
}
})
Expand All @@ -102,7 +102,7 @@ function QueryAutoRefresh({
});
}
if (!cleanInactiveRequestRef.current && !shouldRequestChecking) {
dispatch(clearInactiveQueries());
dispatch(clearInactiveQueries(QUERY_UPDATE_FREQ));
cleanInactiveRequestRef.current = true;
}
};
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/src/SqlLab/reducers/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8ba0b81

Please sign in to comment.