Make sure replication task clean up is triggered

To trigger replication task cleanup `ReplicationState.allScheduled`
variable must be set to true.  This is done via
'ReplicationState.markAllFetchTaskScheduled`. Make sure that
'ReplicationState.markAllFetchTaskScheduled` is called before that is
scheduled. If not and task is quick enought it will finish before
markAllFetchTaskScheduled and notificatyFinished will not clean up task
properly

Feature: Issue 13100
Change-Id: I7431b2275ddd357bb04e0578200c68d4a392a69d
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java
index b3ab83d..7470c2c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/FetchCommand.java
@@ -59,8 +59,8 @@
     }
 
     try {
-      Future<?> future = source.get().schedule(name, refName, state, true);
       state.markAllFetchTasksScheduled();
+      Future<?> future = source.get().schedule(name, refName, state, true);
       future.get(source.get().getTimeout(), TimeUnit.SECONDS);
     } catch (ExecutionException
         | IllegalStateException