Skip to content

Conversation

@simonmarty
Copy link
Contributor

@simonmarty simonmarty commented Oct 31, 2025

  • Update dependencies
  • Close secret cache object in tests as suggested by linter.
  • Use the AWS SDK exponential backoff logic

Issue #, if available:

Description of changes:

Updated the library to use Duration and Instant to represent time amounts.
The current backoff and retry logic has a long overflow bug here. This only comes into play if AWS Secrets Manager is inaccessible for hours at a time.
Switched the custom backoff and retry logic to backoff and jitter helpers provided by the AWS SDK for Java v2 which tops out the backoff at the SDK default of 20s. Added unit tests.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 97.56098% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.15%. Comparing base (db8a853) to head (29947a5).

Files with missing lines Patch % Lines
...ecretsmanager/caching/cache/SecretCacheObject.java 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                 v2     #170      +/-   ##
============================================
+ Coverage     90.86%   99.15%   +8.28%     
- Complexity       90      101      +11     
============================================
  Files             6        6              
  Lines           230      237       +7     
  Branches         24       21       -3     
============================================
+ Hits            209      235      +26     
+ Misses           18        0      -18     
+ Partials          3        2       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@simonmarty simonmarty marked this pull request as ready for review October 31, 2025 18:25
@simonmarty simonmarty requested a review from a team as a code owner October 31, 2025 18:25
harsheejshah
harsheejshah previously approved these changes Oct 31, 2025
Copy link

@harsheejshah harsheejshah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing closing an object approving

@simonmarty simonmarty requested a review from lohdipak October 31, 2025 20:39
@simonmarty simonmarty self-assigned this Oct 31, 2025
/**
* The default TTL for an item stored in cache before access causing a refresh.
*/
public static final Duration DEFAULT_CACHE_ITEM_TTL_DURATION = Duration.ofHours(1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this public? imo we can define this as private.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it match DEFAULT_CACHE_ITEM_TTL for backwards compatibility, that way if customers are using it they have a path forward.

* This prevents continuous refreshNow() calls by adding a random sleep.
*/
public static final long DEFAULT_FORCE_REFRESH_JITTER = 100;
public static final Duration DEFAULT_FORCE_REFRESH_JITTER_DURATION = Duration.ofMillis(100);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this public? imo its used internally so we can make it private

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it match DEFAULT_FORCE_REFRESH_JITTER for backwards compatibility, that way if customers are using it they have a path forward.

@simonmarty simonmarty marked this pull request as draft November 3, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants