]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/lib/schedulers/abstract-scheduler.ts
Fix notification with large message
[github/Chocobozzz/PeerTube.git] / server / lib / schedulers / abstract-scheduler.ts
... / ...
CommitLineData
1export abstract class AbstractScheduler {
2
3 protected abstract schedulerIntervalMs: number
4
5 private interval: NodeJS.Timer
6
7 enable () {
8 if (!this.schedulerIntervalMs) throw new Error('Interval is not correctly set.')
9
10 this.interval = setInterval(() => this.execute(), this.schedulerIntervalMs)
11 }
12
13 disable () {
14 clearInterval(this.interval)
15 }
16
17 abstract execute ()
18}