This commit is contained in:
wphan
2024-11-27 11:10:34 -08:00
parent fa8fd24fd4
commit 00e167da19
2 changed files with 5 additions and 5 deletions

View File

@@ -181,7 +181,7 @@ export const setHealthStatus = (status: HEALTH_STATUS): void => {
* We may be hit by multiple sources performing health checks on us, so this middleware will latch * We may be hit by multiple sources performing health checks on us, so this middleware will latch
* to its health state and only update every `healthCheckInterval`. * to its health state and only update every `healthCheckInterval`.
* *
* A grace period is also used to only report unhealthy if we have been unhealthy beyond the grace period. * A grace period is also used to report unhealthy only if we have been unhealthy beyond the grace period.
*/ */
const handleHealthCheck = ( const handleHealthCheck = (
healthCheckGracePeriod: number, healthCheckGracePeriod: number,
@@ -226,14 +226,14 @@ const handleHealthCheck = (
lastHealthCheckPerformed = Date.now(); lastHealthCheckPerformed = Date.now();
if (!lastHealthCheckState && !inGracePeriod) { if (!lastHealthCheckState && !inGracePeriod) {
healthStatus = HEALTH_STATUS.UnhealthySlotSubscriber; setHealthStatus(HEALTH_STATUS.UnhealthySlotSubscriber);
res.writeHead(500); res.writeHead(500);
res.end(`NOK`); res.end(`NOK`);
return; return;
} }
healthStatus = HEALTH_STATUS.Ok; setHealthStatus(HEALTH_STATUS.Ok);
res.writeHead(200); res.writeHead(200);
res.end('OK'); res.end('OK');
}; };

View File

@@ -238,7 +238,7 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
Date.now() - lastMarketSlotAndTime.ts > MAKRET_STALENESS_THRESHOLD && Date.now() - lastMarketSlotAndTime.ts > MAKRET_STALENESS_THRESHOLD &&
!skipSlotCheck !skipSlotCheck
) { ) {
console.log( logger.warn(
`Unhealthy process due to same slot for market ${marketName} after > ${MAKRET_STALENESS_THRESHOLD}ms. dlobProviderSlot: ${slot}, marketSlot: ${l2Formatted['marketSlot']}` `Unhealthy process due to same slot for market ${marketName} after > ${MAKRET_STALENESS_THRESHOLD}ms. dlobProviderSlot: ${slot}, marketSlot: ${l2Formatted['marketSlot']}`
); );
setHealthStatus(HEALTH_STATUS.Restart); setHealthStatus(HEALTH_STATUS.Restart);
@@ -246,7 +246,7 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
lastMarketSlotAndTime && lastMarketSlotAndTime &&
l2Formatted['marketSlot'] !== lastMarketSlotAndTime.slot l2Formatted['marketSlot'] !== lastMarketSlotAndTime.slot
) { ) {
console.log( logger.warn(
`Updating market slot for ${marketArgs.marketName} with slot ${l2Formatted['marketSlot']}` `Updating market slot for ${marketArgs.marketName} with slot ${l2Formatted['marketSlot']}`
); );
this.lastMarketSlotMap this.lastMarketSlotMap