mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user