From a8fd22d1ddd2b92f84b5599f45c6854acd0ef60b Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Fri, 15 Dec 2023 13:06:44 -0800 Subject: [PATCH] undefined guard and remove resubscribe for drift client --- src/index.ts | 18 +++++++++--------- src/publishers/dlobPublisher.ts | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/index.ts b/src/index.ts index 44f73fd..1aeb7d0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -789,8 +789,8 @@ const main = async () => { if (useRedis) { if ( !isSpot && - `${includeVamm}`.toLowerCase() === 'true' && - `${includeOracle}`.toLowerCase().toLowerCase() === 'true' && + `${includeVamm}`?.toLowerCase() === 'true' && + `${includeOracle}`?.toLowerCase() === 'true' && !grouping ) { let redisL2: string; @@ -814,9 +814,9 @@ const main = async () => { l2Formatted = redisL2; } else if ( isSpot && - `${includeSerum}`.toLowerCase() === 'true' && - `${includePhoenix}`.toLowerCase() === 'true' && - `${includeOracle}`.toLowerCase() === 'true' && + `${includeSerum}`?.toLowerCase() === 'true' && + `${includePhoenix}`?.toLowerCase() === 'true' && + `${includeOracle}`?.toLowerCase() === 'true' && !grouping ) { let redisL2: string; @@ -971,8 +971,8 @@ const main = async () => { if (useRedis) { if ( !isSpot && - normedParam['includeVamm'].toLowerCase() === 'true' && - normedParam['includeOracle'].toLowerCase() === 'true' && + normedParam['includeVamm']?.toLowerCase() === 'true' && + normedParam['includeOracle']?.toLowerCase() === 'true' && !normedParam['grouping'] ) { let redisL2: string; @@ -996,8 +996,8 @@ const main = async () => { } } else if ( isSpot && - normedParam['includePhoenix'].toLowerCase() === 'true' && - normedParam['includeSerum'].toLowerCase() === 'true' && + normedParam['includePhoenix']?.toLowerCase() === 'true' && + normedParam['includeSerum']?.toLowerCase() === 'true' && !normedParam['grouping'] ) { let redisL2: string; diff --git a/src/publishers/dlobPublisher.ts b/src/publishers/dlobPublisher.ts index ae6dca0..7556956 100644 --- a/src/publishers/dlobPublisher.ts +++ b/src/publishers/dlobPublisher.ts @@ -60,7 +60,8 @@ const useOrderSubscriber = const useGrpc = process.env.USE_GRPC?.toLowerCase() === 'true'; const useWebsocket = process.env.USE_WEBSOCKET?.toLowerCase() === 'true'; -const ORDERBOOK_UPDATE_INTERVAL = 1000; +const ORDERBOOK_UPDATE_INTERVAL = + parseInt(process.env.ORDERBOOK_UPDATE_INTERVAL) || 1000; const WS_FALLBACK_FETCH_INTERVAL = 10_000; logger.info(`RPC endpoint: ${endpoint}`); @@ -166,7 +167,6 @@ const main = async () => { accountSubscription = { type: 'websocket', commitment: stateCommitment, - resubTimeoutMs: 30_000, }; slotSubscriber = new SlotSubscriber(connection); await slotSubscriber.subscribe();