Repository navigation
CallFuture follow-up: Consumer error handlers, accurate comments - #108
Merged
Merged
Conversation
…comments Error handlers passed to Client.settle are now CallFuture.Consumer<Throwable> instead of Function<Throwable, Void>, dropping the 'return null;' at every call site and the Function interface. Fix comments left over from #107: the connect timeout fails the future on the executor (the scheduler timer hops there first), and the connect error handler still defers to a separate executor task because a failure from failPendingCalls() arrives in the middle of processDisconnect.
The guard checked the listener field, which is never set for a listener registered after completion and is cleared on settle, so a second listener was rejected only while the future was pending.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #107.
Client.settleare nowCallFuture.Consumer<Throwable>instead ofFunction<Throwable, Void>. This drops thereturn null;from 16 lambdas inClientandSubscriptionand removes theCallFuture.Functioninterface. No behaviour change.CallFuture.whenCompletenow rejects a second listener even after the future is done. The old check looked at thelistenerfield, which is never set when a listener is registered after completion and is cleared on settle, so it worked only while the future was pending. New test:testSecondListenerRejected.ConnectFailureHandlingTest: the timeout timer fires on the scheduler thread but hops to the executor before failing the future.sendConnect: explains why the connect error handler still defers to a separate executor task. A failure fromfailPendingCalls()arrives in the middle ofprocessDisconnect, which must finish before the handler reports the error and disconnects again../gradlew :centrifuge:testpasses (110 tests).