mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add null checks and defaults for the cached smoke test results
This commit is contained in:
parent
98efa96f3e
commit
8d337a26db
1 changed files with 7 additions and 2 deletions
|
@ -45,14 +45,19 @@ resCacher =
|
||||||
contentType:(@setContentType)->
|
contentType:(@setContentType)->
|
||||||
send:(@code, @body)->
|
send:(@code, @body)->
|
||||||
|
|
||||||
|
#default the server to be down
|
||||||
|
code:500
|
||||||
|
body:{}
|
||||||
|
setContentType:"application/json"
|
||||||
|
|
||||||
do runSmokeTest = ->
|
do runSmokeTest = ->
|
||||||
logger.log("running smoke tests")
|
logger.log("running smoke tests")
|
||||||
smokeTest.run(require.resolve(__dirname + "/test/smoke/js/SmokeTests.js"))({}, resCacher)
|
smokeTest.run(require.resolve(__dirname + "/test/smoke/js/SmokeTests.js"))({}, resCacher)
|
||||||
setTimeout(runSmokeTest, 20 * 1000)
|
setTimeout(runSmokeTest, 20 * 1000)
|
||||||
|
|
||||||
app.get "/health_check", (req, res)->
|
app.get "/health_check", (req, res)->
|
||||||
res.contentType(resCacher.setContentType)
|
res.contentType(resCacher?.setContentType)
|
||||||
res.send resCacher.code, resCacher.body
|
res.send resCacher?.code, resCacher?.body
|
||||||
|
|
||||||
app.use (error, req, res, next) ->
|
app.use (error, req, res, next) ->
|
||||||
logger.error err: error, "server error"
|
logger.error err: error, "server error"
|
||||||
|
|
Loading…
Reference in a new issue