Skip to content

Conversation

@BrennanConroy
Copy link
Member

I'm limiting this change to just adding the CONNECTING state and modifying a couple things so it works as expected.

Part 2 will fix things like calling stop while in the middle of start, but I want to clean up the code a bit before doing that, so I'm planning on making a "clean up" PR before doing Part 2.

Easier to review if you turn off whitespace changes.

Progress towards #23291

@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Jul 21, 2020
@BrennanConroy BrennanConroy added this to the 5.0.0-rc1 milestone Jul 21, 2020
} else {
negotiate = tokenCompletable.andThen(Single.defer(() -> Single.just(new NegotiateResponse(baseUrl))));
}
hubConnectionState = HubConnectionState.CONNECTING;
Copy link
Member

Choose a reason for hiding this comment

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

We should do verbose logging for each state transition.

// subscribe makes this a "hot" completable so this runs immediately
}).subscribeWith(start);
// subscribe makes this a "hot" completable so this runs immediately
}).subscribe(() -> {
Copy link
Member

Choose a reason for hiding this comment

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

The CONNECTING->CONNECTED state transition is hidden in this diff, but we should assert the previous state where we can.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a PR that extracts this into a method, I'll add the logging though

// On start we're going to receive the handshake response and also an invocation in the same payload.
hubConnection.start();
mockTransport.getStartTask().timeout(1, TimeUnit.SECONDS).blockingAwait();
String sentMessage = handshakeMessageTask.timeout(1, TimeUnit.SECONDS).blockingGet();
Copy link
Member

Choose a reason for hiding this comment

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

Do these short 1 second timeouts ever cause flakiness? If not, I'm impressed.

Copy link
Member Author

Choose a reason for hiding this comment

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

There were one or two flaky tests in java but I don't think they were ever related to these timeouts.

And actually, yesterday I was looking into them and there is a pretty good reason these never trigger. We can talk about it later today.

@BrennanConroy BrennanConroy changed the base branch from master to release/5.0 August 21, 2020 23:05
hubConnectionStateLock.lock();
try {
if (hubConnectionState != HubConnectionState.DISCONNECTED) {
logger.debug("Another start is in progress. Waiting for start to complete.");
Copy link
Member

Choose a reason for hiding this comment

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

The hub could be already-started here too, right? Maybe log the current state.

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

I don't love approving this without the changes to assert previous states and log state transitions, but I trust those are coming.

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

Labels

area-signalr Includes: SignalR clients and servers tell-mode Indicates a PR which is being merged during tell-mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants