Skip to content

Commit 9baf974

Browse files
committed
Clean up failed loadbalance target
Closes gh-958, gh-982 Signed-off-by: Rossen Stoyanchev <[email protected]>
1 parent f6c8814 commit 9baf974

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rsocket-core/src/main/java/io/rsocket/loadbalance/PooledRSocket.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2020 the original author or authors.
2+
* Copyright 2015-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -85,8 +85,8 @@ public void onError(Throwable t) {
8585
}
8686

8787
this.doFinally();
88-
// terminate upstream which means retryBackoff has exhausted
89-
this.terminate(t);
88+
// terminate upstream (retryBackoff has exhausted) and remove from the parent target list
89+
this.doCleanup(t);
9090
}
9191

9292
@Override
@@ -108,15 +108,15 @@ protected void doSubscribe() {
108108

109109
@Override
110110
protected void doOnValueResolved(RSocket value) {
111-
value.onClose().subscribe(null, t -> this.doCleanup(), this::doCleanup);
111+
value.onClose().subscribe(null, this::doCleanup, () -> doCleanup(ON_DISPOSE));
112112
}
113113

114-
void doCleanup() {
114+
void doCleanup(Throwable t) {
115115
if (isDisposed()) {
116116
return;
117117
}
118118

119-
this.dispose();
119+
this.terminate(t);
120120

121121
final RSocketPool parent = this.parent;
122122
for (; ; ) {

0 commit comments

Comments
 (0)