Browse Source
properly catch error running cron job
pull/1349/head
Bernd Storath
8 months ago
No known key found for this signature in database
GPG Key ID: D6C85685A555540F
1 changed files with
5 additions and
6 deletions
-
src/server/utils/WireGuard.ts
|
|
@ -43,7 +43,6 @@ class WireGuard { |
|
|
|
} |
|
|
|
|
|
|
|
debug('Loading configuration...'); |
|
|
|
// TODO: Better way to invalidate cache
|
|
|
|
this.#configCache = null; |
|
|
|
try { |
|
|
|
const config = await fs.readFile(path.join(WG_PATH, 'wg0.json'), 'utf8'); |
|
|
@ -575,13 +574,13 @@ Endpoint = ${WG_HOST}:${WG_CONFIG_PORT}`; |
|
|
|
} |
|
|
|
|
|
|
|
const inst = new WireGuard(); |
|
|
|
inst.getConfig().catch((err) => { |
|
|
|
console.error(err); |
|
|
|
process.exit(1); |
|
|
|
}); |
|
|
|
|
|
|
|
// This also has to also start the WireGuard Server
|
|
|
|
async function cronJobEveryMinute() { |
|
|
|
await inst.cronJobEveryMinute(); |
|
|
|
await inst.cronJobEveryMinute().catch((err) => { |
|
|
|
debug('Running Cron Job failed.'); |
|
|
|
console.error(err); |
|
|
|
}); |
|
|
|
setTimeout(cronJobEveryMinute, 60 * 1000); |
|
|
|
} |
|
|
|
cronJobEveryMinute(); |
|
|
|