make sure restart if global healthState is unhealhty

This commit is contained in:
wphan
2025-07-23 18:45:08 -07:00
parent be7ab05eee
commit 0c8cd1fec9
2 changed files with 12 additions and 2 deletions

View File

@@ -46,6 +46,14 @@ function evaluateHealth(currentSlot: number): {
return { isHealthy: true }; return { isHealthy: true };
} }
const currentHealthStatus = getHealthStatus();
if (currentHealthStatus !== HEALTH_STATUS.Ok) {
return {
isHealthy: false,
reason: `Unhealthy state: ${currentHealthStatus}`,
};
}
const timeDelta = now - globalHealthState.lastSlotTimestamp; const timeDelta = now - globalHealthState.lastSlotTimestamp;
const slotDelta = currentSlot - globalHealthState.lastSlot; const slotDelta = currentSlot - globalHealthState.lastSlot;

View File

@@ -128,7 +128,9 @@ const SPOT_MARKETS_TO_LOAD =
: undefined; : undefined;
const enableOffloadQueue = process.env.ENABLE_OFFLOAD === 'true'; const enableOffloadQueue = process.env.ENABLE_OFFLOAD === 'true';
const ignoreList = process.env.IGNORE_LIST?.split(',') || ['5N1AcdftujhXWZdBaqfciaKtXn6uVBKjmgwf6aQxR1vW']; const ignoreList = process.env.IGNORE_LIST?.split(',') || [
'5N1AcdftujhXWZdBaqfciaKtXn6uVBKjmgwf6aQxR1vW',
];
logger.info(`RPC endpoint: ${endpoint}`); logger.info(`RPC endpoint: ${endpoint}`);
logger.info(`WS endpoint: ${wsEndpoint}`); logger.info(`WS endpoint: ${wsEndpoint}`);
@@ -479,7 +481,7 @@ const main = async () => {
const orderSubscriber = new OrderSubscriberFiltered({ const orderSubscriber = new OrderSubscriberFiltered({
driftClient, driftClient,
subscriptionConfig, subscriptionConfig,
ignoreList ignoreList,
}); });
dlobProvider = getDLOBProviderFromOrderSubscriber(orderSubscriber); dlobProvider = getDLOBProviderFromOrderSubscriber(orderSubscriber);