overleaf/services/web/modules/server-ce-scripts/scripts/check-redis.js
Jakob Ackermann 8742a29d80 Merge pull request #4315 from overleaf/jpa-import-ce-scripts
[scripts] import scripts from server-ce and add tests

GitOrigin-RevId: 07e7e15aa86030ccd3eca40ed40e5492622dc2d1
2021-07-14 12:41:10 +00:00

18 lines
448 B
JavaScript

const RedisWrapper = require('../../../app/src/infrastructure/RedisWrapper')
const rclient = RedisWrapper.client('health_check')
rclient.on('error', err => {
console.error('Cannot connect to redis.')
console.error(err)
process.exit(1)
})
rclient.healthCheck(err => {
if (err) {
console.error('Cannot connect to redis.')
console.error(err)
process.exit(1)
} else {
console.error('Redis is up.')
process.exit(0)
}
})