Don't log stack trace in cache tests (#11610)

This commit is contained in:
Gregory Michael Travis 2024-11-21 08:22:41 +00:00 committed by GitHub
parent 76ad3475c8
commit 39a176e61b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View File

@ -99,7 +99,7 @@ public class LRUCache<M> {
*/
private CacheResult<M> makeRequestAndCache(String cacheKey, ItemBuilder<M> itemBuilder)
throws IOException, InterruptedException, ResponseTooLargeException {
assert !cache.containsKey(cacheKey);
assert !cache.containsKey(cacheKey) : "Cache should not contain key " + cacheKey;
Item<M> item = itemBuilder.buildItem();
@ -135,7 +135,9 @@ public class LRUCache<M> {
return getResultForCacheEntry(cacheKey);
} catch (IOException e) {
logger.log(
Level.WARNING, "Failure storing cache entry; will re-execute without caching: {}", e);
Level.WARNING,
"Failure storing cache entry; will re-execute without caching: {}",
e.getMessage());
// Re-issue the request since we don't know if we've consumed any of the response.
Item<M> rerequested = itemBuilder.buildItem();
return new CacheResult<>(rerequested.stream(), rerequested.metadata());
@ -255,7 +257,8 @@ public class LRUCache<M> {
toRemove.add(mapEntry);
totalSize -= mapEntry.getValue().size();
}
assert totalSize <= maxTotalCacheSize;
assert totalSize <= maxTotalCacheSize
: "totalSize > maxTotalCacheSize (" + totalSize + " > " + maxTotalCacheSize + ")";
removeCacheEntries(toRemove);
}

View File

@ -71,7 +71,7 @@ public class LRUCacheSettings {
"Unable to parse environment variable "
+ MAX_FILE_SIZE_ENV_VAR
+ ": {}, falling back to default",
e);
e.getMessage());
return DEFAULT_MAX_FILE_SIZE;
}
}
@ -92,7 +92,7 @@ public class LRUCacheSettings {
"Unable to parse environment variable "
+ TOTAL_CACHE_SIZE_ENV_VAR
+ ": {}, falling back to default",
e);
e.getMessage());
return new TotalCacheLimit.Percentage(DEFAULT_TOTAL_CACHE_SIZE_FREE_SPACE_PERCENTAGE);
}
}