joerghoh commented on code in PR #74:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/74#discussion_r905963985
##########
src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java:
##########
@@ -1251,20 +1251,29 @@ private Map<String, List<String>>
loadVanityPaths(ResourceResolver resolver) {
log.debug("end vanityPath query; elapsed {}ms",
TimeUnit.NANOSECONDS.toMillis(queryElapsed));
long count = 0;
+ long countInScope = 0;
long processStart = System.nanoTime();
while (i.hasNext()) {
count += 1;
final Resource resource = i.next();
final String resourcePath = resource.getPath();
if (Stream.of(this.factory.getObservationPaths()).anyMatch(path ->
path.matches(resourcePath))) {
+ countInScope += 1;
final boolean addToCache = isAllVanityPathEntriesCached()
|| vanityCounter.longValue() <
this.factory.getMaxCachedVanityPathEntries();
loadVanityPath(resource, resolveMapsMap, targetPaths,
addToCache);
}
}
long processElapsed = System.nanoTime() - processStart;
- log.debug("processed {} vanityPaths in {}ms", count,
TimeUnit.NANOSECONDS.toMillis(processElapsed));
+ log.debug("processed {} vanityPaths (of which {} in scope) in {}ms",
count, countInScope, TimeUnit.NANOSECONDS.toMillis(processElapsed));
+ if (!isAllVanityPathEntriesCached()) {
+ if (countInScope > this.factory.getMaxCachedVanityPathEntries()) {
+ log.warn("Number of vanity paths in scope ({}) exceeds
configured cache size ({})", countInScope,
this.factory.getMaxCachedVanityPathEntries());
Review Comment:
What is the consequence of this?
Also can we add a call-to-action to this? Would "Increase the cache size" be
the right recommendation?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]