fix(sqllab): Add threshold for checking inactive queries (#24536)

Co-authored-by: Justin Park <justinpark@apache.org>
This commit is contained in:
JUST.in DO IT 2023-06-29 14:06:12 -07:00 committed by GitHub
parent 19deb9141d
commit 8ba0b81957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -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) {

View File

@ -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;
}
};

View File

@ -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;