1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-13 06:40:06 +02:00

Fix metrics playback

This commit is contained in:
JUDIT GRESKOVITS 2017-04-06 15:49:52 +01:00
parent 587889e4b0
commit 1d8f4c7e9a
2 changed files with 5 additions and 5 deletions

View File

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

View File

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