aboutsummaryrefslogtreecommitdiff
path: root/lib/scheduler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scheduler.ts')
-rw-r--r--lib/scheduler.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/scheduler.ts b/lib/scheduler.ts
index e1437bd..8715733 100644
--- a/lib/scheduler.ts
+++ b/lib/scheduler.ts
@@ -4,15 +4,18 @@ import { EventModel, Event } from './event.model';
export type Handler = (event: Event<any>) => void;
-const CronJob = cron.CronJob;
+const { CronJob } = cron;
const defaultPollingInterval = '*/10 * * * * *';
class Scheduler {
private jobs: cron.CronJob[];
+
private pollingJob: cron.CronJob;
+
private handlers: Record<string, Handler>;
+
public Model: EventModel<any>;
constructor(model: EventModel<any>, pollingInterval = defaultPollingInterval) {
@@ -79,8 +82,7 @@ class Scheduler {
event.start();
await handleEvent(event);
return event.complete();
- } else throw new Error('No handler found')
-
+ } throw new Error('No handler found');
} catch (error) {
return event.fail(error);
}