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
This commit is contained in:
Patrick Hiesel
2018-04-27 08:46:10 +02:00
parent a8bae8376d
commit ea2d0a5b5a

View File

@@ -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