[misc] apply review feedback
This commit is contained in:
committed by
Henry Oswald
parent
b8125e396a
commit
9807b51519
12
app.js
12
app.js
@@ -192,7 +192,7 @@ app.get('/oops', function(req, res, next) {
|
|||||||
|
|
||||||
app.get('/status', (req, res, next) => res.send('CLSI is alive\n'))
|
app.get('/status', (req, res, next) => res.send('CLSI is alive\n'))
|
||||||
|
|
||||||
let PROCESS_IS_TOO_OLD = false
|
Settings.processTooOld = false
|
||||||
if (Settings.processLifespanLimitMs) {
|
if (Settings.processLifespanLimitMs) {
|
||||||
Settings.processLifespanLimitMs +=
|
Settings.processLifespanLimitMs +=
|
||||||
Settings.processLifespanLimitMs * (Math.random() / 10)
|
Settings.processLifespanLimitMs * (Math.random() / 10)
|
||||||
@@ -203,16 +203,16 @@ if (Settings.processLifespanLimitMs) {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
logger.log('shutting down, process is too old')
|
logger.log('shutting down, process is too old')
|
||||||
PROCESS_IS_TOO_OLD = true
|
Settings.processTooOld = true
|
||||||
}, Settings.processLifespanLimitMs)
|
}, Settings.processLifespanLimitMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.smokeTest) {
|
if (Settings.smokeTest) {
|
||||||
function runSmokeTest() {
|
function runSmokeTest() {
|
||||||
if (PROCESS_IS_TOO_OLD) return
|
if (Settings.processTooOld) return
|
||||||
logger.log('running smoke tests')
|
logger.log('running smoke tests')
|
||||||
smokeTest.triggerRun(err => {
|
smokeTest.triggerRun(err => {
|
||||||
logger.error({ err }, 'smoke tests failed')
|
if (err) logger.error({ err }, 'smoke tests failed')
|
||||||
setTimeout(runSmokeTest, 30 * 1000)
|
setTimeout(runSmokeTest, 30 * 1000)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,9 @@ if (Settings.smokeTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.get('/health_check', function(req, res) {
|
app.get('/health_check', function(req, res) {
|
||||||
if (PROCESS_IS_TOO_OLD) return res.status(500).json({ processToOld: true })
|
if (Settings.processTooOld) {
|
||||||
|
return res.status(500).json({ processTooOld: true })
|
||||||
|
}
|
||||||
smokeTest.sendLastResult(res)
|
smokeTest.sendLastResult(res)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user