Skip to content

Commit

Permalink
Revert "add: stop cron tasks on server exit/sigint/sigterm"
Browse files Browse the repository at this point in the history
This reverts commit 03eaa62
  • Loading branch information
yaroslav-fedyshyn-nordwhale committed May 28, 2020
1 parent 03eaa62 commit c748dd9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
7 changes: 2 additions & 5 deletions src/server/server-dev.js
Expand Up @@ -6,20 +6,17 @@ import config from '../../webpack.dev.config'
import conf from './server.config'
import { GunDBPublic } from './gun/gun-middleware'
import app from './app'
import exitHandler from './utils/exitHandler'

process.on('uncaughtException', (err, origin) => {
console.log(`Caught exception: ${err}\nException origin: ${origin}`)
console.log(err.stack)
exitHandler({ exit: true, exitCode: -1 })
process.exit(-1)
})

process.on('unhandledRejection', (reason, promise) => {
console.log('Unhandled Rejection at:', promise, 'reason:', reason)
// Application specific logging, throwing an error, or other logic here
})
process.on('SIGINT', exitHandler.bind(null, { exit: true }))
process.on('SIGTERM', exitHandler.bind(null, { exit: true }))

const compiler = webpack(config)
// app.use(webpackDevMiddleware(compiler, {
// publicPath: config.output.publicPath
Expand Down
7 changes: 2 additions & 5 deletions src/server/server-prod.js
Expand Up @@ -4,22 +4,19 @@ import express from 'express'
import conf from './server.config'
import { GunDBPublic } from './gun/gun-middleware'
import app from './app'
import exitHandler from './utils/exitHandler'

export default function start(workerId) {
console.log(`start workerId = ${workerId}`)

process.on('uncaughtException', (err, origin) => {
console.log(`Uncaught exception: ${err}\nException origin: ${origin}`)
exitHandler({ exit: true, exitCode: -1 })
process.exit(-1)
})

process.on('unhandledRejection', (reason, promise) => {
console.log('Unhandled Rejection at:', promise, 'reason:', reason)
// Application specific logging, throwing an error, or other logic here
})
process.on('SIGINT', exitHandler.bind(null, { exit: true }))
process.on('SIGTERM', exitHandler.bind(null, { exit: true }))

const DIST_DIR = __dirname

const HTML_FILE = path.join(DIST_DIR, 'index.html')
Expand Down
14 changes: 0 additions & 14 deletions src/server/utils/exitHandler.js

This file was deleted.

0 comments on commit c748dd9

Please sign in to comment.