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 somebody1234
parent 3008b2c9d2
commit b17e34e162
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);
}
}