diff options
Diffstat (limited to 'server/lib/schedulers/abstract-scheduler.ts')
-rw-r--r-- | server/lib/schedulers/abstract-scheduler.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/lib/schedulers/abstract-scheduler.ts b/server/lib/schedulers/abstract-scheduler.ts new file mode 100644 index 000000000..473544ddf --- /dev/null +++ b/server/lib/schedulers/abstract-scheduler.ts | |||
@@ -0,0 +1,16 @@ | |||
1 | import { SCHEDULER_INTERVAL } from '../../initializers' | ||
2 | |||
3 | export abstract class AbstractScheduler { | ||
4 | |||
5 | private interval: NodeJS.Timer | ||
6 | |||
7 | enable () { | ||
8 | this.interval = setInterval(() => this.execute(), SCHEDULER_INTERVAL) | ||
9 | } | ||
10 | |||
11 | disable () { | ||
12 | clearInterval(this.interval) | ||
13 | } | ||
14 | |||
15 | protected abstract execute () | ||
16 | } | ||