Skip to content

Commit 23af2cc

Browse files
robertroeserNiteshKant
authored andcommitted
after 5 errors remove the ReactiveSocketFactory from the activefactory list (#201)
1 parent 7ee6fe3 commit 23af2cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

reactivesocket-client/src/main/java/io/reactivesocket/client/LoadBalancer.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ void close() {
600600
private class SocketAdder implements Subscriber<ReactiveSocket> {
601601
private final ReactiveSocketClient factory;
602602

603+
private int errors = 0;
604+
603605
private SocketAdder(ReactiveSocketClient factory) {
604606
this.factory = factory;
605607
}
@@ -632,7 +634,11 @@ public void onError(Throwable t) {
632634
logger.warn("Exception while subscribing to the ReactiveSocket source", t);
633635
synchronized (LoadBalancer.this) {
634636
pendingSockets -= 1;
635-
activeFactories.add(factory);
637+
if (++errors < 5) {
638+
activeFactories.add(factory);
639+
} else {
640+
logger.warn("Exception count greater than 5, not re-adding factory {}", factory.toString());
641+
}
636642
}
637643
}
638644

0 commit comments

Comments
 (0)