Skip to content

Commit

Permalink
Merge pull request opencast#843 from dennis531/fix-error-number
Browse files Browse the repository at this point in the history
Remove reset of error number
  • Loading branch information
lkiesow authored Jul 24, 2024
2 parents 33def3c + fba9e32 commit ea0a526
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ const Header = () => {
// Fetching health status information at mount
loadHealthStatus().then((r) => console.info(r));
// Fetch health status every minute
setInterval(() => dispatch(fetchHealthStatus()), 5000);
const interval = setInterval(() => dispatch(fetchHealthStatus()), 5000);

// Event listener for handle a click outside of dropdown menu
window.addEventListener("mousedown", handleClickOutside);

return () => {
clearInterval(interval);
window.removeEventListener("mousedown", handleClickOutside);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
14 changes: 2 additions & 12 deletions src/slices/healthSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,6 @@ const healthSlice = createSlice({
builder
.addCase(fetchHealthStatus.pending, (state) => {
state.statusHealth = 'loading';

// Reset state of health status
let healthStatus = {
name: STATES_NAMES,
status: "",
error: false,
};
state.service = mapHealthStatus(state, healthStatus);
state.numErr = 0;
state.error = false;
})
.addCase(fetchHealthStatus.fulfilled, (state, action: PayloadAction<
FetchHealthStatusResponse
Expand Down Expand Up @@ -121,17 +111,17 @@ const healthSlice = createSlice({
error: false,
};
state.service = mapHealthStatus(state, healthStatus);
state.error = false;
} else {
healthStatus = {
name: BACKEND_NAMES,
status: ERROR,
error: true,
};
state.service = mapHealthStatus(state, healthStatus);

state.error = true;
state.numErr += 1;
}
state.numErr = abnormal;
}
})
.addCase(fetchHealthStatus.rejected, (state, action) => {
Expand Down

0 comments on commit ea0a526

Please sign in to comment.