Fix metrics playback
This commit is contained in:
parent
587889e4b0
commit
1d8f4c7e9a
@ -21,8 +21,8 @@ const StyledContainer = styled.div`
|
||||
`;
|
||||
|
||||
// TMP - single source of truth
|
||||
const duration = '1 hour';
|
||||
const interval = '2 minutes';
|
||||
const duration = '5 minutes';
|
||||
const interval = '15 seconds';
|
||||
|
||||
class Services extends React.Component {
|
||||
// we DON'T want to unsubscribe once we started going
|
||||
|
@ -9,16 +9,16 @@ const tick = (dispatch) => {
|
||||
|
||||
export const subscribe = (interval) => (dispatch) => {
|
||||
if(timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
clearInterval(timeoutId);
|
||||
}
|
||||
const timeout = interval ?
|
||||
getDurationMilliseconds(interval) :
|
||||
120 * 1000;
|
||||
timeoutId = setTimeout(tick, timeout, dispatch);
|
||||
timeoutId = setInterval(tick, timeout, dispatch);
|
||||
};
|
||||
|
||||
export const unsubscribe = () => () => {
|
||||
if(timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
clearInterval(timeoutId);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user