File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/main/java/com/github/brainlag/nsq Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ public NSQConsumer start() {
71
71
//connect once otherwise we might have to wait one lookupPeriod
72
72
connect ();
73
73
scheduler .scheduleAtFixedRate (() -> {
74
- connect ();
74
+ connect ();
75
75
}, lookupPeriod , lookupPeriod , TimeUnit .MILLISECONDS );
76
76
}
77
77
return this ;
@@ -88,6 +88,7 @@ private Connection createConnection(final ServerAddress serverAddress) {
88
88
89
89
return connection ;
90
90
} catch (final NoConnectionsException e ) {
91
+ LogManager .getLogger (this ).warn ("Could not create connection to server {}" , serverAddress .toString (), e );
91
92
return null ;
92
93
}
93
94
}
@@ -205,7 +206,10 @@ private void connect() {
205
206
206
207
for (final ServerAddress server : Sets .difference (newAddresses , oldAddresses )) {
207
208
if (!connections .containsKey (server )) {
208
- connections .put (server , createConnection (server ));
209
+ final Connection connection = createConnection (server );
210
+ if (connection != null ) {
211
+ connections .put (server , connection );
212
+ }
209
213
}
210
214
}
211
215
}
You can’t perform that action at this time.
0 commit comments