1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-10 21:30: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 // TMP - single source of truth
const duration = '1 hour'; const duration = '5 minutes';
const interval = '2 minutes'; const interval = '15 seconds';
class Services extends React.Component { class Services extends React.Component {
// we DON'T want to unsubscribe once we started going // we DON'T want to unsubscribe once we started going

View File

@ -9,16 +9,16 @@ const tick = (dispatch) => {
export const subscribe = (interval) => (dispatch) => { export const subscribe = (interval) => (dispatch) => {
if(timeoutId) { if(timeoutId) {
clearTimeout(timeoutId); clearInterval(timeoutId);
} }
const timeout = interval ? const timeout = interval ?
getDurationMilliseconds(interval) : getDurationMilliseconds(interval) :
120 * 1000; 120 * 1000;
timeoutId = setTimeout(tick, timeout, dispatch); timeoutId = setInterval(tick, timeout, dispatch);
}; };
export const unsubscribe = () => () => { export const unsubscribe = () => () => {
if(timeoutId) { if(timeoutId) {
clearTimeout(timeoutId); clearInterval(timeoutId);
} }
}; };