aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers/abstract-scheduler.ts
blob: 473544ddfff1d78ba23ed5861f4597c9be779b11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { SCHEDULER_INTERVAL } from '../../initializers'

export abstract class AbstractScheduler {

  private interval: NodeJS.Timer

  enable () {
    this.interval = setInterval(() => this.execute(), SCHEDULER_INTERVAL)
  }

  disable () {
    clearInterval(this.interval)
  }

  protected abstract execute ()
}