Reindex after database transaction was completed

Bug: Issue 3135
Change-Id: Iad6ddd2cd563da81c5d2e75e203cab4216e2375d
diff --git a/src/main/java/com/googlesource/gerrit/plugins/wip/BaseAction.java b/src/main/java/com/googlesource/gerrit/plugins/wip/BaseAction.java
index 556954e..45536ac 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/wip/BaseAction.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/wip/BaseAction.java
@@ -14,11 +14,7 @@
 
 package com.googlesource.gerrit.plugins.wip;
 
-import java.io.IOException;
-import java.util.Collections;
-
 import com.google.common.base.Strings;
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.gerrit.extensions.restapi.ResourceConflictException;
 import com.google.gerrit.reviewdb.client.Change;
 import com.google.gerrit.reviewdb.client.Change.Status;
@@ -33,6 +29,9 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
+import java.io.IOException;
+import java.util.Collections;
+
 abstract class BaseAction {
   static class Input {
     String message;
@@ -80,14 +79,12 @@
       db.changeMessages().insert(Collections.singleton(
           newMessage(input, change)));
 
-      CheckedFuture<?, IOException> indexFuture =
-          indexer.indexAsync(change.getId());
-      indexFuture.checkedGet();
-
       db.commit();
     } finally {
       db.rollback();
     }
+
+    indexer.index(db, change);
   }
 
   private ChangeMessage newMessage(Input input,