This repository has been archived on 2022-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
2017-08-02 21:24:01 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const path = require('path')
|
|
|
|
|
2020-01-28 20:27:24 +00:00
|
|
|
require('@babel/register')({
|
2020-05-28 18:30:21 +00:00
|
|
|
plugins: ['@babel/plugin-transform-modules-commonjs']
|
2017-08-02 21:24:01 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
process.once('message', (args) => {
|
2020-07-06 18:33:00 +00:00
|
|
|
process.env.NODE_ENV = args.dev ? 'development' : 'production'
|
2017-08-02 21:24:01 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
require(path.join(__dirname, 'server'))(args)
|
|
|
|
console.log('Worker process starting')
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
process.on('message', (message) => {
|
2020-07-06 18:33:00 +00:00
|
|
|
if (message !== 'stop') return
|
|
|
|
console.log('Recieved stop signal')
|
|
|
|
const knex = require(path.join(__dirname, '../scripts/load-database')).knex
|
2017-08-02 21:24:01 +00:00
|
|
|
|
2020-07-06 18:33:00 +00:00
|
|
|
knex.destroy(() => process.exit(0))
|
2017-08-02 21:24:01 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
process.send('started')
|
|
|
|
})
|