ayushtkn commented on issue #2046: URL: https://github.com/apache/polaris/issues/2046#issuecomment-4863182002
Thanx @snazy I think https://docs.aws.amazon.com/smithy-kotlin/api/latest/aws-credentials/aws.smithy.kotlin.runtime.auth.awscredentials/-cached-credentials-provider/ has a concept of `refreshBufferWindow`, We might use something like that and introduce a config ``` public static final FeatureConfiguration<Integer> STORAGE_CREDENTIAL_REFRESH_BUFFER_SECONDS = PolarisConfiguration.<Integer>builder() .key("STORAGE_CREDENTIAL_REFRESH_BUFFER_SECONDS") .description( "The minimum remaining validity (in seconds) that a cached storage credential must " + "have before it is evicted and refreshed. Credentials are removed from the " + "cache when their remaining lifetime drops to this value. Must be less than " + STORAGE_CREDENTIAL_DURATION_SECONDS.key() + ".") .defaultValue(0) .buildFeatureConfiguration(); ``` And maybe a logic like this ``` Expiry.creating( (StorageCredentialCacheKey key, StorageCredentialCacheEntry entry) -> { long remainingMs = entry.getExpirationTime() - System.currentTimeMillis(); long effectiveTtl = entry.refreshBufferMs() > 0 ? remainingMs - entry.refreshBufferMs() : remainingMs / 2; long expireAfterMillis = Math.max(0, Math.min(effectiveTtl, entry.maxCacheDurationMs())); return Duration.ofMillis(expireAfterMillis); ``` wdyt? -- 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]
