fix(sqllab): infinite running state on disconnect (#23669)

This commit is contained in:
JUST.in DO IT
2023-04-18 12:26:29 -07:00
committed by GitHub
parent 8bd432274a
commit 0c0d2b38a6
5 changed files with 158 additions and 38 deletions

View File

@@ -742,6 +742,21 @@ export default function sqlLabReducer(state = {}, action) {
}
return { ...state, queries: newQueries, queriesLastUpdate };
},
[actions.CLEAR_INACTIVE_QUERIES]() {
const { queries } = state;
const cleanedQueries = Object.fromEntries(
Object.entries(queries).filter(([, query]) => {
if (
['running', 'pending'].includes(query.state) &&
query.progress === 0
) {
return false;
}
return true;
}),
);
return { ...state, queries: cleanedQueries };
},
[actions.SET_USER_OFFLINE]() {
return { ...state, offline: action.offline };
},