From 9271bd8fd660503370d0ee948be5f3e58d36c603 Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Wed, 4 Dec 2024 19:37:11 -0800 Subject: [PATCH 1/2] use grpc for drift client for dlob publishers --- drift-common | 2 +- src/publishers/dlobPublisher.ts | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drift-common b/drift-common index 78cb08e..0303c32 160000 --- a/drift-common +++ b/drift-common @@ -1 +1 @@ -Subproject commit 78cb08e848cffa103a4c382948237f8f5113b967 +Subproject commit 0303c32d038e1ea1c9c21fc5c31f16730eed5fc3 diff --git a/src/publishers/dlobPublisher.ts b/src/publishers/dlobPublisher.ts index 05f86a7..dbd29ec 100644 --- a/src/publishers/dlobPublisher.ts +++ b/src/publishers/dlobPublisher.ts @@ -324,7 +324,24 @@ const main = async () => { let accountSubscription: DriftClientSubscriptionConfig; let slotSource: SlotSource; - if (!useWebsocket) { + // USE_GRPC=true will override websocket + if (useGrpc) { + accountSubscription = { + type: 'grpc', + resubTimeoutMs: 30_000, + grpcConfigs: { + endpoint, + token, + }, + }; + + slotSubscriber = new SlotSubscriber(connection); + await slotSubscriber.subscribe(); + + slotSource = { + getSlot: () => slotSubscriber!.getSlot(), + }; + } else if (!useWebsocket) { bulkAccountLoader = new BulkAccountLoader( connection, stateCommitment, From 2bb423053b641e93ea5f11335b76bc7b940b5c9c Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Wed, 4 Dec 2024 19:39:11 -0800 Subject: [PATCH 2/2] bump common --- drift-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drift-common b/drift-common index 0303c32..78cb08e 160000 --- a/drift-common +++ b/drift-common @@ -1 +1 @@ -Subproject commit 0303c32d038e1ea1c9c21fc5c31f16730eed5fc3 +Subproject commit 78cb08e848cffa103a4c382948237f8f5113b967