Skip to content

Commit

Permalink
Dispatch action to remove old measure. repeatedly
Browse files Browse the repository at this point in the history
See also: #10
  • Loading branch information
BECATRUE committed Dec 4, 2024
1 parent 4baec80 commit ca68c8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wlm-ui/src/MainPage/Channel/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ const Channel = (props: IProps) => {
return () => socket.close();
}, [dispatch, props.channel.channel]);

useEffect(() => {
const channel = props.channel.channel;

const interval = setInterval(() => {
dispatch(channelListActions.removeOldMeasurements({ channel: channel }));
}, 10 * 60 * 1000);

return () => clearInterval(interval);
}, [dispatch, props.channel.channel]);

useEffect(() => {
setIsInUseButtonEnabled(true);
}, [props.inUse]);
Expand Down
3 changes: 3 additions & 0 deletions wlm-ui/src/store/slices/channel/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export const channelListSlice = createSlice({
const info = getChannelInfoWithException(state, channel);
info.measurements.push(measurement);
},
removeOldMeasurements: (state, action: PayloadAction<Pick<ChannelType, 'channel'>>) => {

},
},
extraReducers: (builder) => {
builder
Expand Down

0 comments on commit ca68c8b

Please sign in to comment.