You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2021/05/04 07:27:18 UTC

[james-project] 02/03: JAMES-3467 Domain cache should include auto-detection

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 793d39f4c94838e8427e233415b98f415e1335af
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Apr 26 22:38:53 2021 +0700

    JAMES-3467 Domain cache should include auto-detection
    
    This allows fully relying on the cache for remote addresses, that previously
    would have been attempting auto-detection all of the time.
---
 .../java/org/apache/james/domainlist/lib/AbstractDomainList.java     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/data/data-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java b/server/data/data-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java
index 2a19598..9f371eb 100644
--- a/server/data/data-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java
+++ b/server/data/data-library/src/main/java/org/apache/james/domainlist/lib/AbstractDomainList.java
@@ -97,7 +97,7 @@ public abstract class AbstractDomainList implements DomainList, Configurable {
             .build(new CacheLoader<>() {
                 @Override
                 public Boolean load(Domain key) throws DomainListException {
-                    return containsDomainInternal(key);
+                    return containsDomainInternal(key) || detectedDomainsContains(key);
                 }
             });
 
@@ -169,8 +169,7 @@ public abstract class AbstractDomainList implements DomainList, Configurable {
     public boolean containsDomain(Domain domain) throws DomainListException {
         if (configuration.isCacheEnabled()) {
             try {
-                boolean internalAnswer = cache.get(domain);
-                return internalAnswer || detectedDomainsContains(domain);
+                return cache.get(domain);
             } catch (ExecutionException e) {
                 if (e.getCause() instanceof DomainListException) {
                     throw (DomainListException) e.getCause();

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org