overleaf/services/web/modules/server-ce-scripts/scripts/check-redis.js
Andrew Rumble b5cd5bd8fa Revert "[web] Migrate modules/server-ce-scripts to ESM"
GitOrigin-RevId: 61d971396b801e7bb3da1c5af7bd5ea4d91f3c9f
2024-10-22 08:07:04 +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)
}
})