Skip to content

Commit fc428b8

Browse files
authored
Merge pull request #278 from EventStore/yoeight/fix-connection-fail-loop
Fix connection service skipping discovery interval sleeps.
2 parents 03ca733 + 1cbf12e commit fc428b8

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

db-client-java/src/main/java/com/eventstore/dbclient/ConnectionService.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ public void createChannel(UUID previousId, InetSocketAddress candidate) {
127127
try {
128128
// TODO - Should we consider a discovery timeout?
129129
this.discovery.run(this.connection).get();
130+
131+
if (this.loadServerFeatures()) {
132+
this.channelId = UUID.randomUUID();
133+
this.connection.confirmChannel();
134+
logger.info("Connection to endpoint [{}] created successfully", this.connection.getLastConnectedEndpoint());
135+
break;
136+
}
130137
} catch (InterruptedException e) {
131138
forceExit(e);
132139
} catch (ExecutionException e) {
@@ -135,17 +142,9 @@ public void createChannel(UUID previousId, InetSocketAddress candidate) {
135142
// that has failed. It's possible that node might still be the best candidate if it manages to
136143
// recover in the meantime.
137144
this.connection.clear();
138-
continue;
139145
}
140146
}
141147

142-
if (this.loadServerFeatures()) {
143-
this.channelId = UUID.randomUUID();
144-
this.connection.confirmChannel();
145-
logger.info("Connection to endpoint [{}] created successfully", this.connection.getLastConnectedEndpoint());
146-
break;
147-
}
148-
149148
// In case a candidate was provided, but we failed to connect to it.
150149
// We force a new discovery process in that case.
151150
candidate = null;

0 commit comments

Comments
 (0)