Skip to content

Revert the async disconnect change #42

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

Merged

Conversation

jhansche
Copy link
Contributor

OkHttp WebSocket does all its work on the proper thread, so the async disconnect change is no longer needed.

Since the disconnectAsync() change brings up a slew of other issues, it's best to just revert that change (3b0041d).

Closes #37

Joe Hansche added 2 commits March 29, 2017 18:02
This reverts commit 3b0041d

The theory is that using OkHttp now, all networking is handled on the correct
thread automatically.

Closes parse-community#37
This also creates a new connectIfNeeded() method, which can be used to
initiate a connection if not already connected or connecting.

The original intent was to connectIfNeeded() during subscribe. While some may
argue that's not necessary, and the client should instead be explicit about
what is intended, this change preserves that original intention.

As it stands, the only way to queue up pending subscriptions _without_
initiating a connection would be to call disconnect() first, even though the
client hasn't been connected yet. That would set the user-initiated flag,
which would therefore refuse to auto-connect during subscribe().
@@ -390,16 +390,6 @@ public void testEmptySessionTokenOnSubscribe() {
}

@Test
public void testDisconnectOnBackgroundThread() throws Exception {
executor.pause();
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also get rid of the fancy executor too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may be useful in the future if we need to test anything that happens asynchronously (like websocket connect/disconnect events, or something like that).

It will likely need to go away if/when #36 is done, because it won't be using an Executor anymore.

I can remove it for now if you think it's better not to have it if we're not using it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like we should just nuke...can't wait for #36 as well

Also introduces the ImmediateExecutor (same as what we used to have, before
switching to PausableExecutor). Similar to, but simpler than,
`bolts.BoltsExecutors#immediate()`.
@rogerhu rogerhu merged commit 15a5c4a into parse-community:master Mar 30, 2017
@jhansche jhansche deleted the pr/revert-async-disconnect branch March 30, 2017 17:21
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.

2 participants