refactor: remove unused async connect path and simplify response handling#42
Merged
refactor: remove unused async connect path and simplify response handling#42
Conversation
sohankshirsagar
approved these changes
Jan 17, 2026
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.
Summary
Removes dead code from
ProtobufCommunicatorwhich has potential issues with blocking the event loop and message multiplexing. The asyncconnect()method and its helpers were never used because the SDK exclusively usesconnect_sync().Changes
Removed:
async def connect()- Unused async connection method with blocking socket calls inside an async functionasync def _send_connect_message()- Helper only called by async connectasync def _receive_connect_response()- Helper only called by async connect_receive_response()that used blocking socket reads and dropped non-matching messages (no multiplexing)Modified:
disconnect()- Changed fromasyncto sync since it only calls_cleanup()_receive_response()- Simplified to always delegate to_wait_for_response_async()via the background reader threaddrift_sdk.py- Updated to calldisconnect()directly instead of viaasyncio.run()Context
The removed async
connect()path had two issues:request_idwere silently discardedThese were latent bugs since the code path was never reached (
connect_sync()is always used), and we probably won't need the async path, but removing them eliminates potential confusion and reduces maintenance burden.