Register a task with setInterval and a interval is not desirable, since the task can take more time than the interval, so the compiler will skip through the current cycle. Replace setInterval with setTimeout with following pattern:
setInterval(function() {
runSomething();
}, interval);
with
(function loop() {
runSomething();
setTimeout(loop, interval);
})();