Skip to content

Commit

Permalink
fix: kill process regurlarly, for cache and bootstrap (#412)
Browse files Browse the repository at this point in the history

Co-Authored-By: Haroen Viaene <[email protected]>
  • Loading branch information
bodinsamuel and Haroenv authored Aug 25, 2019
1 parent b785e8f commit 9c778b2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,25 @@ 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)
* - Watch : will process update in real time
*/
async function main() {
const start = Date.now();

// We schedule to kill the process:
// - reset cache
// - maybe retrigger bootstrap
setTimeout(() => {
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 {
Expand Down

0 comments on commit 9c778b2

Please sign in to comment.