debug unhealthy SlotSubscriber
This commit is contained in:
@@ -126,9 +126,11 @@ const handleHealthCheck = async (req, res, next) => {
|
|||||||
if (req.url === '/health' || req.url === '/') {
|
if (req.url === '/health' || req.url === '/') {
|
||||||
// check if a slot was received recently
|
// check if a slot was received recently
|
||||||
let healthySlotSubscriber = false;
|
let healthySlotSubscriber = false;
|
||||||
|
let slotChanged = false;
|
||||||
|
let slotChangedRecently = false;
|
||||||
await lastSlotReceivedMutex.runExclusive(async () => {
|
await lastSlotReceivedMutex.runExclusive(async () => {
|
||||||
const slotChanged = lastSlotReceived > lastHealthCheckSlot;
|
slotChanged = lastSlotReceived > lastHealthCheckSlot;
|
||||||
const slotChangedRecently =
|
slotChangedRecently =
|
||||||
Date.now() - lastHealthCheckSlotUpdated < healthCheckInterval;
|
Date.now() - lastHealthCheckSlotUpdated < healthCheckInterval;
|
||||||
healthySlotSubscriber = slotChanged || slotChangedRecently;
|
healthySlotSubscriber = slotChanged || slotChangedRecently;
|
||||||
logger.debug(
|
logger.debug(
|
||||||
@@ -142,6 +144,9 @@ const handleHealthCheck = async (req, res, next) => {
|
|||||||
if (!healthySlotSubscriber) {
|
if (!healthySlotSubscriber) {
|
||||||
healthStatus = HEALTH_STATUS.UnhealthySlotSubscriber;
|
healthStatus = HEALTH_STATUS.UnhealthySlotSubscriber;
|
||||||
logger.error(`SlotSubscriber is not healthy`);
|
logger.error(`SlotSubscriber is not healthy`);
|
||||||
|
logger.error(
|
||||||
|
`Slotsubscriber health check: lastSlotReceived: ${lastSlotReceived}, lastHealthCheckSlot: ${lastHealthCheckSlot}, slotChanged: ${slotChanged}, slotChangedRecently: ${slotChangedRecently}`
|
||||||
|
);
|
||||||
|
|
||||||
res.writeHead(500);
|
res.writeHead(500);
|
||||||
res.end(`SlotSubscriber is not healthy`);
|
res.end(`SlotSubscriber is not healthy`);
|
||||||
|
|||||||
Reference in New Issue
Block a user