-
Notifications
You must be signed in to change notification settings - Fork 356
Loadbalancer: closing doesn't subscribe to the underlying #148
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
Conversation
***Problem*** Closing the loadbalancer doesn't properly subscribe to the `Publisher`s returned by the `close()` methods of the underlying `ReactiveSocket`. Thus, the close event is lost at the LoadBalancer level. ***Solution*** Properly subscribe to the close `Publisher`s and propagate the `onComplete` events when all `ReactiveSocket` are closed. (I choose to ignore any exception that happened during the close, i.e. only propagate 1 `onComplete`).
@Override | ||
public void onError(Throwable t) { | ||
if (n.decrementAndGet() == 0) { | ||
subscriber.onComplete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can propagate the onError to the subscriber here?
EDIT: just saw your description, I think would be nice to log the error so we know if there was an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
one minor comment, LGTM |
|
||
@Override | ||
public void onComplete() { | ||
if (n.decrementAndGet() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're doing the same thing in the onComplete and the onError - why not just call onComplete in the onError method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, it makes the code simpler.
`CONNECTION_CLOSE` error code As discussed in issue rsocket#59 having an error code to indicate "safe closure" similar to GO_AWAY frame in HTTP/2 will be useful to indicate graceful shutdown as opposed to a fatal erro.
_Problem_
Closing the loadbalancer doesn't properly subscribe to the
Publisher
sreturned by the
close()
methods of the underlyingReactiveSocket
.Thus, the close event is lost at the LoadBalancer level.
_Solution_
Properly subscribe to the close
Publisher
s and propagate theonComplete
events when all
ReactiveSocket
are closed. (I choose to ignore any exceptionthat happened during the close, i.e. only propagate 1
onComplete
).