From bd520a4c6228fa534e6f22185566e6770560987c Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Sat, 11 Nov 2023 09:28:19 -0800 Subject: [PATCH] patch --- src/index.ts | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/index.ts b/src/index.ts index b817de1..03f6c1c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -165,17 +165,22 @@ const main = async () => { commitment: stateCommitment, }); - driftClient = new DriftClient({ - connection, - wallet, - programID: clearingHousePublicKey, - accountSubscription: { - type: 'websocket', - resubTimeoutMs: 60000, - }, - env: driftEnv, - userStats: true, - }); + const bulkAccountLoader = new BulkAccountLoader( + connection, + stateCommitment, + ORDERBOOK_UPDATE_INTERVAL * 10 + ), + driftClient = new DriftClient({ + connection, + wallet, + programID: clearingHousePublicKey, + accountSubscription: { + type: 'polling', + accountLoader: bulkAccountLoader, + }, + env: driftEnv, + userStats: true, + }); const dlobCoder = DLOBOrdersCoder.create(); const slotSubscriber = new SlotSubscriber(connection, {}); @@ -208,11 +213,7 @@ const main = async () => { await userMap.subscribe(); const userStatsMap = new UserStatsMap(driftClient, { type: 'polling', - accountLoader: new BulkAccountLoader( - connection, - stateCommitment, - ORDERBOOK_UPDATE_INTERVAL * 10 - ), + accountLoader: bulkAccountLoader, }); await userStatsMap.subscribe();