From 5b31486dc91ac9570daa21e39a7acd36932b5f19 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Fri, 22 Jul 2022 19:32:43 +0200 Subject: [PATCH] Randomize certificate renewal check over a whole day --- src/cron.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cron.js b/src/cron.js index ab9a62520..fb695fd34 100644 --- a/src/cron.js +++ b/src/cron.js @@ -114,8 +114,9 @@ async function startJobs() { start: true }); + // randomized over minute an hours, once a day to not hammer Let'sEncrypt on the same schedule gJobs.certificateRenew = new CronJob({ - cronTime: '00 00 */12 * * *', // every 12 hours + cronTime: `00 ${parseInt(Math.random()*60)} ${parseInt(Math.random()*24)} * * *`, onTick: async () => await safe(cloudron.renewCerts({}, AuditSource.CRON), { debug }), start: true });