Reconnect through normal websocket setup#40
Conversation
|
|
|
thanks for this! would you be willing to help me update the ci/lint infra on this repo? |
|
Yes, happy to help. I’ll keep this reconnect PR scoped and take a separate pass at the CI/lint infra so it’s easier to review. I’ll first reproduce the current lint/CI failures locally, then open a focused follow-up PR with the smallest set of changes needed to get the checks useful again. |
|
Update after #42 merged: I rebuilt this branch on current Local verification on the rebuilt branch:
The new commit is |
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
f1290c0 to
d622036
Compare
| uri = URI(@_uri) | ||
| EventMachine.reconnect uri.host, uri.port, @_websocket_client | ||
| @_websocket_client.post_init | ||
| self._connection_id += 1 |
There was a problem hiding this comment.
since we increment this before calling _websocket_close, could there not be a race condition here between this function and the onclose hook above?
There was a problem hiding this comment.
Good point to call out. The increment before close is meant to invalidate the old websocket's onclose handler before close can synchronously fire it.
I added a regression in 3e4419f where close invokes the previous onclose block during reconnect!; it asserts the disconnected callback is not called and the new websocket is still installed.
Local verification against 3e4419f:
RUBYOPT=-rem/pure_ruby bundle exec rspecbundle exec rubocopgit diff --check
The GitHub Actions run for 3e4419f is action_required with no jobs, so it looks like it needs maintainer approval before CI can run.
Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
Summary
Fixes #33
Verification
bundle exec rspec spec/unit/action_cable_client_spec.rbbundle exec rspecbundle exec rubocopgit diff --check origin/master...HEADHosted CI
26799993832: RuboCop and Ruby 2.3/2.4/2.5/2.6/2.7 test jobs passed