Skip to content

Commit

Permalink
Decrease polling interval (500ms is too slow)
Browse files Browse the repository at this point in the history
  • Loading branch information
kravets-levko committed May 3, 2019
1 parent a84227c commit 6425c56
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions client/app/components/dashboards/AutoHeightController.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ const WIDGET_CONTENT_SELECTOR = [
'.spinner-container', // loading state
'.tile__bottom-control', // footer
].join(',');
const INTERVAL = 500;
const INTERVAL = 200;

export default class AutoHeightController {
widgets = {}
widgets = {};

interval = null
interval = null;

onHeightChange = null
onHeightChange = null;

constructor(handler) {
this.onHeightChange = handler;
Expand Down Expand Up @@ -61,7 +61,7 @@ export default class AutoHeightController {
}, 0);
},
];
}
};

remove = (id) => {
// not actually deleting from this.widgets to prevent case of unwanted re-adding
Expand All @@ -70,11 +70,11 @@ export default class AutoHeightController {
if (this.isEmpty()) {
this.stop();
}
}
};

exists = id => !!this.widgets[id.toString()]
exists = id => !!this.widgets[id.toString()];

isEmpty = () => !some(this.widgets)
isEmpty = () => !some(this.widgets);

checkHeightChanges = () => {
Object.keys(this.widgets).forEach((id) => {
Expand All @@ -85,22 +85,22 @@ export default class AutoHeightController {
this.onHeightChange(id, height); // dispatch
}
});
}
};

start = () => {
this.stop();
this.interval = setInterval(this.checkHeightChanges, INTERVAL);
}
};

stop = () => {
clearInterval(this.interval);
}
};

resume = () => {
if (!this.isEmpty()) {
this.start();
}
}
};

destroy = () => {
this.stop();
Expand Down

0 comments on commit 6425c56

Please sign in to comment.