From 0c8cd1fec9edfb9f0354a99cc34c5550ab4a8619 Mon Sep 17 00:00:00 2001 From: wphan Date: Wed, 23 Jul 2025 18:45:08 -0700 Subject: [PATCH] make sure restart if global healthState is unhealhty --- src/core/healthCheck.ts | 8 ++++++++ src/publishers/dlobPublisher.ts | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/healthCheck.ts b/src/core/healthCheck.ts index 1761524..fd54f48 100644 --- a/src/core/healthCheck.ts +++ b/src/core/healthCheck.ts @@ -46,6 +46,14 @@ function evaluateHealth(currentSlot: number): { return { isHealthy: true }; } + const currentHealthStatus = getHealthStatus(); + if (currentHealthStatus !== HEALTH_STATUS.Ok) { + return { + isHealthy: false, + reason: `Unhealthy state: ${currentHealthStatus}`, + }; + } + const timeDelta = now - globalHealthState.lastSlotTimestamp; const slotDelta = currentSlot - globalHealthState.lastSlot; diff --git a/src/publishers/dlobPublisher.ts b/src/publishers/dlobPublisher.ts index 1560d78..c2bad22 100644 --- a/src/publishers/dlobPublisher.ts +++ b/src/publishers/dlobPublisher.ts @@ -128,7 +128,9 @@ const SPOT_MARKETS_TO_LOAD = : undefined; 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(`WS endpoint: ${wsEndpoint}`); @@ -479,7 +481,7 @@ const main = async () => { const orderSubscriber = new OrderSubscriberFiltered({ driftClient, subscriptionConfig, - ignoreList + ignoreList, }); dlobProvider = getDLOBProviderFromOrderSubscriber(orderSubscriber);