Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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