Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review error result TTL handling in lookup caches #19159

Open
kroepke opened this issue Apr 24, 2024 · 0 comments
Open

Review error result TTL handling in lookup caches #19159

kroepke opened this issue Apr 24, 2024 · 0 comments

Comments

@kroepke
Copy link
Member

kroepke commented Apr 24, 2024

When debugging a customer issue, the below code looks like it doesn't properly take the error result case into account.

final LookupResult result = loader.call();
if (ignoreResult(result, config.ignoreNull())) {
LOG.trace("Ignoring failed lookup for key {}", key);
return LookupResult.builder()
.cacheTTL(0L)
.build();
}
if (isResultEmpty(result)) {
LOG.trace("Empty lookup for key {} with TTL {}", key, ttlEmptyMillis());
return LookupResult.builder()
.cacheTTL(ttlEmptyMillis())
.build();
}
return result;

Error results have null values but are flagged as errors and come with custom TTL values. It looks like the code does not use that value and instead defaults to 0, "empty TTL" or forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants