Skip to content

Commit 097a747

Browse files
Merge pull request #214 from dannya/retry-missed-executions
fix: Catch missed exectutions, and retry if exectution is missed. Fixes #213
2 parents 73d3bf5 + 799fcbc commit 097a747

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ else
108108
{
109109
const schedule = `*/${config.linkUpTimeInterval} * * * *`;
110110
logger.info("Starting cron schedule: " + schedule)
111-
cron.schedule(schedule, () =>
111+
const task = cron.schedule(schedule, () =>
112112
{
113113
main().then()
114114
}, {});
115+
116+
// Catch missed exectutions, and retry if exectution is missed
117+
task.on('execution:missed', () => {
118+
main().then();
119+
});
115120
}
116121

117122
async function main(): Promise<void>

0 commit comments

Comments
 (0)