2020-11-09 16:21:05 +00:00
|
|
|
// execute this script with a redis container running to test the health check
|
|
|
|
// starting and stopping redis with this script running is a good test
|
2019-09-19 14:05:32 +00:00
|
|
|
|
2020-11-09 16:21:05 +00:00
|
|
|
const redis = require('../../')
|
2021-10-28 09:23:06 +00:00
|
|
|
const logger = require('@overleaf/logger')
|
2019-09-19 14:05:32 +00:00
|
|
|
|
2020-11-09 16:21:05 +00:00
|
|
|
const rclient = redis.createClient({ host: 'localhost', port: '6379' })
|
|
|
|
|
|
|
|
setInterval(() => {
|
2021-12-16 09:04:32 +00:00
|
|
|
rclient.healthCheck(err => {
|
2020-11-09 16:21:05 +00:00
|
|
|
if (err) {
|
2020-11-10 09:40:38 +00:00
|
|
|
logger.error({ err }, 'HEALTH CHECK FAILED')
|
2020-11-09 16:21:05 +00:00
|
|
|
} else {
|
2022-05-16 12:40:25 +00:00
|
|
|
logger.info('HEALTH CHECK OK')
|
2020-11-09 16:21:05 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}, 1000)
|