From ea2d0a5b5ad28f52bf48ff718b97a0cc5cdbc3fd Mon Sep 17 00:00:00 2001 From: Patrick Hiesel Date: Fri, 27 Apr 2018 08:46:10 +0200 Subject: [PATCH] Return a WorkQueue executor with two threads for FanOut in tests We usually use a direct executor in tests as it is hard to catch multi-thread bugs in tests since they usually just result in a flake. However, the improvements in ChangeJson and AccountCache are new and at least for now it'd be nice to get *some* test coverage on parallelization. Change-Id: I5697f6b4fdf92dabbbe924f234a0d4c1e4e3a48c --- java/com/google/gerrit/testing/InMemoryModule.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/com/google/gerrit/testing/InMemoryModule.java b/java/com/google/gerrit/testing/InMemoryModule.java index b63830ea63..7d798290c5 100644 --- a/java/com/google/gerrit/testing/InMemoryModule.java +++ b/java/com/google/gerrit/testing/InMemoryModule.java @@ -59,6 +59,7 @@ import com.google.gerrit.server.git.GarbageCollection; import com.google.gerrit.server.git.GitRepositoryManager; import com.google.gerrit.server.git.PerThreadRequestScope; import com.google.gerrit.server.git.SearchingChangeCacheImpl; +import com.google.gerrit.server.git.WorkQueue; import com.google.gerrit.server.index.IndexModule.IndexType; import com.google.gerrit.server.index.account.AccountSchemaDefinitions; import com.google.gerrit.server.index.account.AllAccountsIndexer; @@ -275,8 +276,8 @@ public class InMemoryModule extends FactoryModule { @Provides @Singleton @FanOutExecutor - public ExecutorService createChangeJsonExecutor() { - return MoreExecutors.newDirectExecutorService(); + public ExecutorService createFanOutExecutor(WorkQueue queues) { + return queues.createQueue(2, "FanOut"); } @Provides