Skip to content

Avoid blocking OkHttp WebSocket callbacks - #17

Open
masaru87 wants to merge 1 commit into
FairyDevicesRD:mainfrom
masaru87:fix/okhttp-receive-buffer
Open

Avoid blocking OkHttp WebSocket callbacks#17
masaru87 wants to merge 1 commit into
FairyDevicesRD:mainfrom
masaru87:fix/okhttp-receive-buffer

Conversation

@masaru87

@masaru87 masaru87 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • replace the rendezvous receive channel with a finite buffered channel
  • use non-blocking trySend from the OkHttp WebSocket callback
  • close the receive flow with MimiIOException if the bounded buffer rejects a response
  • verify that a response received before Flow collection returns promptly and remains available to the collector

The previous Channel() and trySendBlocking combination blocked the OkHttp listener thread until a Flow collector was ready. A response arriving between connect completion and collection could therefore stall the WebSocket callback.

Testing

  • ./gradlew :engine:okhttp:test --no-daemon
  • ./gradlew jvmTest --no-daemon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant