Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTN15h*: Handle incoming DISCONNECTED while CONNECTED #179

Merged
merged 13 commits into from Aug 14, 2020

Conversation

tcard
Copy link
Contributor

@tcard tcard commented Jul 31, 2020

Implements RTN15h*.

It's a predicate, so the name should reflect that.
This opens the door for RTN15h1, which will share some logic with the
handling of FAILED but doesn't have a FAILED protocol message.

This shared logic has been moved to an external method.
RTN15h happens in the context of an incoming DISCONNECTED, not FAILED.
failedConnSideEffects will be called only when we're sure we're moving
to FAILED.
Adds handling of both success and failure of such reconnection.
@tcard tcard requested a review from gernest July 31, 2020 18:09
@tcard tcard self-assigned this Jul 31, 2020
We removed it from the inner connectWith method because now we can
reconnect while already in state CONNECTED, but we do need the check in
case the user calls Connect explicitly.
Copy link
Contributor

@gernest gernest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I left a few comments.

ably/realtime_conn.go Outdated Show resolved Hide resolved
var change ably.ConnectionStateChange
ablytest.Instantly.Recv(t, &change, stateChanges, t.Fatalf)

if change.Event != ably.ConnectionEventUpdated {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is failing with a different event here

--- FAIL: TestRealtimeConn_RTN15h2_Success (0.00s)
    realtime_conn_spec_test.go:1230: expected UPDATED event; got {DISCONNECTED DISCONNECTED CONNECTED [ErrorInfo :timeout code=80003 statusCode=0] See https://help.ably.io/error/80003}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and similar intermittent errors should've been fixed by 324acf8.

tcard and others added 4 commits August 11, 2020 17:09
Co-authored-by: Geofrey Ernest <geofreyernest@live.com>
Some tests were intermittently failing because of usage of real time by
MessagePipe, while the test used mocked time. Those tests aren't
interested in timeouts anyway, so do it only when we're explicitly
interested.
All the un/locking was causing partially inconsistent states to be
observed by tests (and, potentially, by the library itself).

Also, fix test so that we don't read msgSerial from a client whose
connection has been recovered by another client; it's not defined what
that means.
@tcard tcard requested a review from gernest August 11, 2020 16:10
// we are setting msgSerial as per (RTN16f)
msgSerial, err := strconv.ParseInt(strings.Split(c.opts.Recover, ":")[2], 10, 64)
if err != nil {
//TODO: how to handle this? Panic?
Copy link
Contributor

@gernest gernest Aug 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to figure out our logging situation at some point. I think implementing the spec is more important at the moment, so its fine if this TODO stays.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved this code around, the TODO was already there.

Anyway, I agree we should improve logging (see #160) once the codebase becomes less of a moving target.

In this particular case, though, I think a panic is in order. A malformed msgSerial just shouldn't ever happen, and it's already panicking if it doesn't have at least two parts separated by :.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, if that is a case you can just as well add a panic here as part of this PR. We don't need to keep that TODO anymore.

@tcard tcard merged commit da47812 into integration/1.2 Aug 14, 2020
@tcard tcard deleted the feature/rtn15h-recv-disconnected branch August 14, 2020 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants