2020-11-09 11:21:05 -05: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 10:05:32 -04:00
|
|
|
|
2020-11-09 11:21:05 -05:00
|
|
|
const redis = require('../../')
|
2021-10-28 05:23:06 -04:00
|
|
|
const logger = require('@overleaf/logger')
|
2019-09-19 10:05:32 -04:00
|
|
|
|
2020-11-09 11:21:05 -05:00
|
|
|
const rclient = redis.createClient({ host: 'localhost', port: '6379' })
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
rclient.healthCheck((err) => {
|
|
|
|
if (err) {
|
2020-11-10 04:40:38 -05:00
|
|
|
logger.error({ err }, 'HEALTH CHECK FAILED')
|
2020-11-09 11:21:05 -05:00
|
|
|
} else {
|
2020-11-10 04:40:38 -05:00
|
|
|
logger.log('HEALTH CHECK OK')
|
2020-11-09 11:21:05 -05:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}, 1000)
|