Permalink
Browse files

fix(App): Bugfix Fix memory leak in recipe polling loop

  • Loading branch information...
haraldox committed Feb 7, 2018
1 parent a585f2b commit c99848fe96bd93196882462b2d57aa77d34894a0
Showing with 6 additions and 1 deletion.
  1. +1 −0 src/models/Service.js
  2. +5 −1 src/stores/ServicesStore.js
@@ -6,6 +6,7 @@ export default class Service {
id = '';
recipe = '';
webview = null;
timer = null;
events: {};
isAttached = false;
@@ -589,12 +589,16 @@ export default class ServicesStore extends Store {
const delay = 1000;
if (service) {
if (service.timer !== null) {
clearTimeout(service.timer)
}
const loop = () => {
if (!service.webview) return;
service.webview.send('poll');
setTimeout(loop, delay);
service.timer = setTimeout(loop, delay);
};
loop();

0 comments on commit c99848f

Please sign in to comment.