Recv/lib/workers/abstractintervalworker.js
Mark van Renswoude 88beaa6f7d Added code and upload expiration checks
Added the feature to override email templates
Added automatic refresh of disk space indicator
2018-05-02 23:01:29 +02:00

45 lines
594 B
JavaScript

class AbstractIntervalWorker
{
start(interval)
{
var self = this;
self.stop();
self.timer = setInterval(async () =>
{
if (self.ticking)
return;
self.ticking = true;
try
{
await self.tick();
}
catch (err)
{
console.log(err);
}
self.ticking = false;
}, interval);
}
stop()
{
var self = this;
if (self.timer)
{
clearInterval(self.timer);
self.timer = null;
}
}
/* Implement this:
async tick()
{
}
*/
}
module.exports = AbstractIntervalWorker;