Skip to content

Commit

Permalink
hotfix(keystone): disable keep alive policy when on worker (#5455)
Browse files Browse the repository at this point in the history
  • Loading branch information
sitozzz authored Nov 11, 2024
1 parent 484dc44 commit 40db612
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/keystone/KSv5v6/v5/prepareKeystone.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const { Keystone } = require('./keystone')
const { validateHeaders } = require('./validateHeaders')

const IS_BUILD_PHASE = conf.PHASE === 'build'
const IS_WORKER_PROCESS = conf.PHASE === 'worker'
const IS_BUILD = conf['DATABASE_URL'] === 'undefined'
const IS_SENTRY_ENABLED = JSON.parse(get(conf, 'SENTRY_CONFIG', '{}'))['server'] !== undefined
const IS_ENABLE_APOLLO_DEBUG = conf.NODE_ENV === 'development'
Expand Down Expand Up @@ -266,14 +267,14 @@ function prepareKeystone ({ onConnect, extendKeystoneConfig, extendExpressApp, s

process.on('uncaughtException', (err, origin) => {
logger.error({ msg: 'uncaughtException', err, origin })
if (!IS_KEEP_ALIVE_ON_ERROR) {
if (IS_WORKER_PROCESS || !IS_KEEP_ALIVE_ON_ERROR) {
throw err
}
})

process.on('unhandledRejection', (err, promise) => {
logger.error({ msg: 'unhandledRejection', err, promise })
if (!IS_KEEP_ALIVE_ON_ERROR) {
if (IS_WORKER_PROCESS || !IS_KEEP_ALIVE_ON_ERROR) {
throw err
}
})
Expand Down

0 comments on commit 40db612

Please sign in to comment.