nastra commented on code in PR #6169:
URL: https://github.com/apache/iceberg/pull/6169#discussion_r1031538544
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -157,22 +154,22 @@ public void initialize(String name, Map<String, String>
unresolved) {
// build the final configuration and set up the catalog's auth
Map<String, String> mergedProps = config.merge(props);
Map<String, String> baseHeaders = configHeaders(mergedProps);
- this.catalogAuth = new AuthSession(baseHeaders, null, null);
- if (authResponse != null) {
- this.catalogAuth = newSession(authResponse, startTimeMillis,
catalogAuth);
- } else if (initToken != null) {
- this.catalogAuth = newSession(initToken, expiresInMs(mergedProps),
catalogAuth);
- }
-
+ this.client = clientBuilder.apply(mergedProps);
this.sessions = newSessionCache(mergedProps);
this.refreshAuthByDefault =
PropertyUtil.propertyAsBoolean(
mergedProps,
CatalogProperties.AUTH_DEFAULT_REFRESH_ENABLED,
CatalogProperties.AUTH_DEFAULT_REFRESH_ENABLED_DEFAULT);
- this.client = clientBuilder.apply(mergedProps);
this.paths = ResourcePaths.forCatalogProperties(mergedProps);
+ this.catalogAuth = new AuthSession(baseHeaders, null, null);
+ if (authResponse != null) {
+ this.catalogAuth = newSession(authResponse, startTimeMillis,
catalogAuth);
+ } else if (initToken != null) {
+ this.catalogAuth = newSession(initToken, expiresInMs(mergedProps),
catalogAuth);
+ }
Review Comment:
this is mainly because `scheduleTokenRefresh` became `static` and moved to
`AuthSession` and we're passing the `client` in both of those `newSession()`
calls. However, with the old code the client` wasn't initialized yet. So this
re-ordering just makes sure that the `client` is initialized before we schedule
a token refresh
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]