bharathgunapati commented on code in PR #58:
URL: 
https://github.com/apache/flink-connector-http/pull/58#discussion_r4371910778


##########
flink-connector-http/src/main/java/org/apache/flink/connector/http/preprocessor/OIDCAuthHeaderValuePreprocessor.java:
##########
@@ -31,7 +31,11 @@ public class OIDCAuthHeaderValuePreprocessor implements 
HeaderValuePreprocessor
 
     private final String oidcAuthURL;
     private final String oidcTokenRequest;
-    private Duration oidcExpiryReduction = Duration.ofSeconds(1);
+    private Duration oidcExpiryReduction =
+            OidcAccessTokenManager.DEFAULT_TOKEN_EXPIRATION_REDUCTION;
+
+    /** Created on first use so the cached token survives across requests but 
is not serialized. */

Review Comment:
   Yes, the comment is true, but it was too short, so I rewrote it.
   
   What happens now: the token manager is created once per preprocessor 
instance and kept. Every lookup that goes through the same instance reuses the 
cached token until it expires. The field is transient, so after deserialization 
it is created again and a new token is fetched on the next request. The test 
`shouldWorkAfterSerialization` covers that case.
   
   Before this PR it did work, but it fetched a new token for every lookup. The 
polling client created a new preprocessor for each lookup, and the preprocessor 
created a new token manager on each call, so nothing was ever reused. Now the 
polling client creates the preprocessor once and the preprocessor keeps its 
token manager. That is what makes the cache real.
   



-- 
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]

Reply via email to