mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #2633 from overleaf/bg-fix-health-check-for-web-api
fix the health check on the api router GitOrigin-RevId: 985322f8e4ff0b5dddbe7cf68c41414af6fd502d
This commit is contained in:
parent
8547bb3c8d
commit
fc028c7544
2 changed files with 21 additions and 1 deletions
|
@ -57,6 +57,26 @@ module.exports = HealthCheckController = {
|
|||
})
|
||||
},
|
||||
|
||||
checkApi(req, res, next) {
|
||||
rclient.healthCheck(err => {
|
||||
if (err) {
|
||||
logger.err({ err }, 'failed api redis health check')
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
UserGetter.getUserEmail(settings.smokeTest.userId, (err, email) => {
|
||||
if (err) {
|
||||
logger.err({ err }, 'failed api mongo health check')
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
if (email == null) {
|
||||
logger.err({ err }, 'failed api mongo health check (no email)')
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
res.sendStatus(200)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
checkRedis(req, res, next) {
|
||||
return rclient.healthCheck(function(error) {
|
||||
if (error != null) {
|
||||
|
|
|
@ -969,7 +969,7 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) {
|
|||
webRouter.get('/dev/csrf', (req, res) => res.send(res.locals.csrfToken))
|
||||
|
||||
publicApiRouter.get('/health_check', HealthCheckController.check)
|
||||
privateApiRouter.get('/health_check', HealthCheckController.check)
|
||||
privateApiRouter.get('/health_check', HealthCheckController.checkApi)
|
||||
|
||||
publicApiRouter.get('/health_check/redis', HealthCheckController.checkRedis)
|
||||
privateApiRouter.get('/health_check/redis', HealthCheckController.checkRedis)
|
||||
|
|
Loading…
Reference in a new issue