gabriel-farache commented on code in PR #4094:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4094#discussion_r2585948785


##########
quarkus/addons/token-exchange/runtime/src/main/java/org/kie/kogito/addons/quarkus/token/exchange/cache/TokenPolicyManager.java:
##########
@@ -55,25 +56,37 @@ public long expireAfterRead(String key, CachedTokens value, 
long currentTime, lo
     }
 
     /**
-     * Calculate time to expiration based on token's actual expiration time 
minus proactive refresh buffer
+     * Calculate time to expiration based on token's actual expiration time 
minus proactive refresh buffer.
+     * This method sets the process instance context from the cache key for 
proper logging.
      */
     private static long calculateTimeToExpiration(String cacheKey, 
CachedTokens tokens) {
-        String authName = CacheUtils.extractAuthNameFromCacheKey(cacheKey);
-        long proactiveRefreshSeconds = Math.max(0, 
ConfigReaderUtils.getProactiveRefreshSeconds(authName));
+        // Extract process instance ID from cache key and set context for 
logging
+        String processInstanceId = 
CacheUtils.extractProcessInstanceIdFromCacheKey(cacheKey);
+        if (processInstanceId != null && !processInstanceId.isEmpty()) {
+            ProcessInstanceContext.setProcessInstanceId(processInstanceId);

Review Comment:
   yes



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

Reply via email to