fix: defer subscribe until connection_ack in GraphQLIndexer - #639
Merged
Jaydbrown merged 1 commit intoAug 31, 2026
Conversation
|
@Abayomi-fx Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Jaydbrown
added a commit
that referenced
this pull request
Aug 31, 2026
…ntations After the batch merges the code from one competing PR landed while a different PR's tests landed alongside it: - factory.test.ts: the merged FactoryModule uses a Map + negative-cache-TTL (not the LruMemoCache from #581), so drop the bounded-LRU-eviction test; add the missing resolveFee stub to the soroban mock (StreamsModule's ctor now calls it); a non-positive list limit resolves to DEFAULT_LIST_LIMIT (20), not 0 (#573). - graphql-indexer-lifecycle.test.ts: #639 defers the subscribe frame until connection_ack, so assert connection_init on open and subscribe only after the ack.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes the GraphQL handshake race condition in
GraphQLIndexer.subscribe. Previously, onsocket.onopen, the client sentconnection_initand then immediately sent thesubscribemessage in the same tick. Spec-compliant GraphQL transports reject this with4401/4408, causing subscriptions to fail and tear down silently.The fix introduces handshake state tracking:
subscribepayloads are queued until the server sendsconnection_ack, then flushed immediately so the subscription is established correctly.Related Issue
Closes the reported bug:
GraphQLIndexer.subscribesendssubscribebeforeconnection_ack.Changes
🔌 Handshake-aware subscribe queue
src/indexer.tsconnectionAckedhandshake flag and a pending-subscribe queue to theGraphQLIndexerlifecycle.subscribeis called beforeconnection_ack, store the parsed subscribe payload instead of sending it immediately.connection_ack, flush any queued subscribe message in the original order.connection_ack, leave the handshake unacked and do not send the queued subscribe.connection_initas the first message onopen; no other protocol message is emitted until ack.Verification Results
subscribeis never sent beforeconnection_ackconnection_acktriggers queue flushCloses #513