From 0525708d9331b6830661209d75579df508beb586 Mon Sep 17 00:00:00 2001 From: Samuel Bodin Date: Mon, 19 Aug 2019 15:56:54 +0200 Subject: [PATCH 1/2] fix: kill process regurlarly, for cache and boostrap --- src/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/index.js b/src/index.js index 519fe7782..f56f8d238 100644 --- a/src/index.js +++ b/src/index.js @@ -11,6 +11,8 @@ import * as watch from './watch.js'; log.info('🗿 npm ↔️ Algolia replication starts ⛷ 🐌 🛰'); +const KILL_PROCESS_EVERY_MS = 12 * 60 * 60 * 1000; // every 12 hours + /** * Main process * - Bootstrap: will index the whole list of packages (if needed) @@ -18,6 +20,16 @@ log.info('🗿 npm ↔️ Algolia replication starts ⛷ 🐌 🛰'); */ async function main() { const start = Date.now(); + + // We schedule to kill the process: + // - reset cache + // - maybe retrigger bootstrap + setInterval(() => { + log.info('👋 Scheduled process cleaning'); + // eslint-disable-next-line no-process-exit + process.exit(0); + }, KILL_PROCESS_EVERY_MS); + // first we make sure the bootstrap index has the correct settings log.info('💪 Setting up Algolia'); const { From 5a0411097fdcfb546326b0505933878bb3ea5f1a Mon Sep 17 00:00:00 2001 From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com> Date: Mon, 19 Aug 2019 16:29:58 +0200 Subject: [PATCH 2/2] Update src/index.js Co-Authored-By: Haroen Viaene --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index f56f8d238..a70f1baa3 100644 --- a/src/index.js +++ b/src/index.js @@ -24,7 +24,7 @@ async function main() { // We schedule to kill the process: // - reset cache // - maybe retrigger bootstrap - setInterval(() => { + setTimeout(() => { log.info('👋 Scheduled process cleaning'); // eslint-disable-next-line no-process-exit process.exit(0);