Fix issue with replication when replicationDelay is set to zero

Issue is cause by race condition. When replicationDelay is set
to zero the task is triggered immediately.
Source.requestRunway(FetchOne) is removing task from pending
as a first operation when task is starting. But  without delay
task will be added to pending when it is already running and will
never be removed from pending which cause further replication to
add refs to task which is already finished instead of creation
new one.

Bug: Issue 13099
Change-Id: If8ede575ceb0ae50e8192198c1321f4f7a3e46a6
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
index 13b1466..06a61bf 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
@@ -392,8 +392,8 @@
         e = opFactory.create(project, uri);
         addRef(e, ref);
         e.addState(ref, state);
-        f = pool.schedule(e, now ? 0 : config.getDelay(), TimeUnit.SECONDS);
         pending.put(uri, e);
+        f = pool.schedule(e, now ? 0 : config.getDelay(), TimeUnit.SECONDS);
       } else if (!e.getRefs().contains(ref)) {
         addRef(e, ref);
         e.addState(ref, state);