Use account cache instead of ReviewDb in MailProcessor Change-Id: Ie9eef1b3d9fda21fbd544986bda1d0a5d51abc67
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/MailProcessor.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/MailProcessor.java index 606da44..51e5739 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/MailProcessor.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/receive/MailProcessor.java
@@ -38,6 +38,7 @@ import com.google.gerrit.server.CommentsUtil; import com.google.gerrit.server.PatchSetUtil; import com.google.gerrit.server.account.AccountByEmailCache; +import com.google.gerrit.server.account.AccountCache; import com.google.gerrit.server.change.EmailReviewComments; import com.google.gerrit.server.config.CanonicalWebUrl; import com.google.gerrit.server.extensions.events.CommentAdded; @@ -84,6 +85,7 @@ private final EmailReviewComments.Factory outgoingMailFactory; private final CommentAdded commentAdded; private final ApprovalsUtil approvalsUtil; + private final AccountCache accountCache; private final Provider<String> canonicalUrl; @Inject @@ -101,6 +103,7 @@ EmailReviewComments.Factory outgoingMailFactory, ApprovalsUtil approvalsUtil, CommentAdded commentAdded, + AccountCache accountCache, @CanonicalWebUrl Provider<String> canonicalUrl) { this.accountByEmailCache = accountByEmailCache; this.buf = buf; @@ -115,6 +118,7 @@ this.outgoingMailFactory = outgoingMailFactory; this.commentAdded = commentAdded; this.approvalsUtil = approvalsUtil; + this.accountCache = accountCache; this.canonicalUrl = canonicalUrl; } @@ -153,7 +157,7 @@ return; } Account.Id account = accounts.iterator().next(); - if (!reviewDb.get().accounts().get(account).isActive()) { + if (!accountCache.get(account).getAccount().isActive()) { log.warn(String.format("Mail: Account %s is inactive. Will delete message.", account)); return; }