Place the replaying flag clearing in a finally

This ensure that 'replaying' will be set to false even if an exception
occurs in pruneNoLongerPending(), otherwise if would be possible for the
distributor to get "stuck" and never be able to run again.

Release-Notes: Avoid opportunity to inadvertently block the distributor
Change-Id: I4628a574ad54ca6abd591138edc48e12a39447e7
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
index ef75bad..4ff7653 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
@@ -229,10 +229,13 @@
 
             @Override
             public void onDone() {
-              if (Prune.TRUE.equals(prune)) {
-                pruneNoLongerPending(new HashSet<>(taskNamesByReplicateRefUpdate.values()));
+              try {
+                if (Prune.TRUE.equals(prune)) {
+                  pruneNoLongerPending(new HashSet<>(taskNamesByReplicateRefUpdate.values()));
+                }
+              } finally {
+                replaying.set(false);
               }
-              replaying.set(false);
             }
 
             @Override