Skip to content

Commit 8746ebd

Browse files
Pass the hardcoded jitter factor explicitly instead of relying on RetryInterceptor's default
RetryInterceptor is generated code we don't maintain, so its internal DEFAULT_JITTER_FACTOR is free to change on a future regeneration. Passing Optional.of(RETRY_JITTER_FACTOR) from VaultClient keeps the 0.2 hardcode visible and owned in our own code instead of implicitly inherited by passing Optional.empty(). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 62f8074 commit 8746ebd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎flowvault/src/main/java/com/skyflow/VaultClient.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public class VaultClient extends BaseVaultClient<VaultConfig> {
3434
private static final int DEFAULT_MAX_RETRIES = 0;
3535
private static final long DEFAULT_INITIAL_RETRY_DELAY_MILLIS = 500L;
3636
private static final long DEFAULT_MAX_RETRY_DELAY_MILLIS = 2000L;
37+
// Not yet exposed as a VaultConfig/builder setting, so hardcoded here rather than left as
38+
// Optional.empty() - passing it explicitly keeps the choice visible in our own code instead of
39+
// depending on RetryInterceptor's internal default, which is free to change on a future
40+
// regeneration since it is generated code we do not maintain.
41+
private static final double RETRY_JITTER_FACTOR = 0.2;
3742

3843
protected VaultClient(VaultConfig vaultConfig, Credentials credentials) throws SkyflowException {
3944
super(vaultConfig, credentials);
@@ -175,10 +180,8 @@ protected void updateExecutorInHTTP() throws SkyflowException {
175180
.callTimeout(timeoutSeconds, TimeUnit.SECONDS)
176181
// OUTER: retries. Must wrap the auth interceptor so each attempt re-reads the
177182
// (possibly refreshed) bearer token rather than replaying a stale one.
178-
// Jitter is left at the generated interceptor's own default (0.2) - not yet
179-
// exposed as a VaultConfig/builder setting.
180183
.addInterceptor(new RetryInterceptor(maxRetries, Optional.of(initialRetryDelayMillis),
181-
Optional.of(maxRetryDelayMillis), Optional.empty()))
184+
Optional.of(maxRetryDelayMillis), Optional.of(RETRY_JITTER_FACTOR)))
182185
.addInterceptor(chain -> { // INNER: auth
183186
Request requestWithAuth = chain.request().newBuilder()
184187
.header("Authorization", "Bearer " + this.token)

0 commit comments

Comments
 (0)