Skip to content

Commit

Permalink
Fix "too many open files" error when running integration tests (apach…
Browse files Browse the repository at this point in the history
…e#800)

This was due to the fact that each token fetch created a new client, and the client wasn't closed.
  • Loading branch information
adutra authored Jan 16, 2025
1 parent 9b1f34f commit 51a4537
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public String obtainToken(PrincipalWithCredentials principal) {

/** Requests an access token from the Polaris server for the given {@link ClientCredentials}. */
public String obtainToken(ClientCredentials credentials) {
return polarisServerManager().accessManager().obtainAccessToken(endpoints, credentials);
return polarisServerManager().accessManager(client).obtainAccessToken(endpoints, credentials);
}

private boolean ownedName(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public interface PolarisServerManager {
*/
Server serverForContext(ExtensionContext context);

default PolarisAccessManager accessManager() {
return new IcebergTokenAccessManager(createClient());
default PolarisAccessManager accessManager(Client client) {
return new IcebergTokenAccessManager(client);
}

/** Create a new HTTP client for accessing the server targeted by tests. */
Expand Down

0 comments on commit 51a4537

Please sign in to comment.