Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/next-release/bugfix-AWSSDKforJavav2-8565660.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "AWS SDK for Java v2",
"contributor": "",
"description": "Fix expiration in past warning from ProfileFileRefresher."
Comment thread
alextwoods marked this conversation as resolved.
Outdated
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public final class ProfileFileRefresher {
private static final ProfileFileRefreshRecord EMPTY_REFRESH_RECORD = ProfileFileRefreshRecord.builder()
.refreshTime(Instant.MIN)
.build();
private static final long STALE_TIME_MS = 1000;
Comment thread
alextwoods marked this conversation as resolved.
private final CachedSupplier<ProfileFileRefreshRecord> profileFileCache;
private volatile ProfileFileRefreshRecord currentRefreshRecord;
private final Supplier<ProfileFile> profileFile;
Expand Down Expand Up @@ -96,7 +97,7 @@ private RefreshResult<ProfileFileRefreshRecord> reloadAsRefreshResultIfStale() {
refreshRecord = currentRefreshRecord;
}

return wrapIntoRefreshResult(refreshRecord, now);
return wrapIntoRefreshResult(refreshRecord, now.plusMillis(STALE_TIME_MS));
}

private <T> RefreshResult<T> wrapIntoRefreshResult(T value, Instant staleTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void refreshIfStale_profileModifiedNoPathSpecified_doesNotReloadProfileFile() {
}

@Test
void refreshIfStale_profileModifiedWithinJitterPeriod_doesNotReloadProfileFile() {
void refreshIfStale_profileModifiedWithinStalePeriod_doesNotReloadProfileFile() {
Path credentialsFilePath = generateTestCredentialsFile("defaultAccessKey", "defaultSecretAccessKey");

AdjustableClock clock = new AdjustableClock();
Expand All @@ -99,7 +99,7 @@ void refreshIfStale_profileModifiedWithinJitterPeriod_doesNotReloadProfileFile()
}

@Test
void refreshIfStale_profileModifiedOutsideJitterPeriod_reloadsProfileFile() {
void refreshIfStale_profileModifiedOutsideStalePeriod_reloadsProfileFile() {
Path credentialsFilePath = generateTestCredentialsFile("defaultAccessKey", "defaultSecretAccessKey");

AdjustableClock clock = new AdjustableClock();
Expand Down
Loading