Skip to content
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

Closed

Conversation

aaronchung-bitquill
Copy link
Contributor

…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.

@aaronchung-bitquill aaronchung-bitquill force-pushed the fix/limitless-no-routers-conn branch 2 times, most recently from aaede5b to 34161bd Compare October 29, 2024 23:13
@aaronchung-bitquill aaronchung-bitquill marked this pull request as ready for review October 29, 2024 23:13
} else {
LOGGER.finest(Messages.get("LimitlessConnectionPlugin.usingProvidedConnectUrl"));
return conn;
return connectFunc.call();
}
}

if (limitlessRouters.contains(hostSpec)) {
Copy link
Contributor

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 {
Copy link
Contributor

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())) {
Copy link
Contributor

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)
Copy link
Contributor

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?

@aaronchung-bitquill
Copy link
Contributor Author

starting again on a new branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants