#!/usr/bin/env node const throng = require('throng'); const { CONCURRENCY } = require('../config'); const { logger } = require('../services/logging'); const util = require('./util'); const program = require('commander'); //============================================================================== // Setting up the program command line arguments. //============================================================================== program .option('-j, --jobs', 'enable job processing on this thread') .option( '--disabled-jobs ', 'disable jobs specified if the -j option is passed, specified as a comma separated list', val => val.split(','), [] ) .option( '-w, --websockets', 'enable the websocket (subscriptions) handler on this thread' ) .parse(process.argv); throng({ workers: CONCURRENCY, start: i => { logger.info({ workerID: i }, 'started worker'); // Load in the serve. const serve = require('../serve'); // Start serving. serve(program).catch(err => { console.error(err); util.shutdown(1); }); }, });