-
Notifications
You must be signed in to change notification settings - Fork 46
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
fix: limitless plugin - reduce extraneous conns made in scenarios whe… #1172
fix: limitless plugin - reduce extraneous conns made in scenarios whe… #1172
Conversation
aaede5b
to
34161bd
Compare
…re router cache is empty
34161bd
to
c97edd6
Compare
} else { | ||
LOGGER.finest(Messages.get("LimitlessConnectionPlugin.usingProvidedConnectUrl")); | ||
return conn; | ||
return connectFunc.call(); | ||
} | ||
} | ||
|
||
if (limitlessRouters.contains(hostSpec)) { |
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.
Let's check for null here
conn = connectFunc.call(); | ||
} | ||
return retryConnectWithLeastLoadedRouters(limitlessRouters, props, conn, hostSpec); | ||
return retryConnectWithLeastLoadedRouters(limitlessRouters, props, connectFunc.call(), connectFunc, hostSpec); | ||
} | ||
|
||
try { |
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.
selectedHostSpec can be null
@@ -252,8 +242,8 @@ private Connection retryConnectWithLeastLoadedRouters( | |||
|
|||
while (retryCount++ < maxRetries) { | |||
if (currentRouters.stream().noneMatch(h -> h.getAvailability().equals(HostAvailability.AVAILABLE))) { | |||
if (conn != null && !conn.isClosed()) { | |||
currentRouters = synchronouslyGetLimitlessRoutersWithRetry(conn, hostSpec.getPort(), props); | |||
if ((conn != null && !conn.isClosed())) { |
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.
What is conn is null but there's a connectFunc?
@@ -119,9 +121,10 @@ public List<HostSpec> forceGetLimitlessRoutersWithConn( | |||
if (!Utils.isNullOrEmpty(limitlessRouters)) { | |||
return limitlessRouters; | |||
} | |||
final List<HostSpec> newLimitlessRouters = connection == null || connection.isClosed() | |||
? this.queryHelper.queryForLimitlessRouters(connectFunc.call(), hostPort) |
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 open a connection and leave it hanging. Can we return this connection back to the plugin and further to a user app?
starting again on a new branch |
…re router cache is empty
Summary
Description
Additional Reviewers
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.