Merge branch 'stable-3.10'

* stable-3.10:
  synchronizePendingEvents: Fix stuck replaying flag

Release-Notes: skip
Change-Id: If0a080b81639d072cf20828e4cd6c9cbce010a8d
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 267ba4e..6a36add 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
@@ -226,8 +226,13 @@
       final Map<ReplicateRefUpdate, String> taskNamesByReplicateRefUpdate =
           new ConcurrentHashMap<>();
       if (Prune.TRUE.equals(prune)) {
-        for (Destination destination : destinations.get().getAll(FilterType.ALL)) {
-          taskNamesByReplicateRefUpdate.putAll(destination.getTaskNamesByReplicateRefUpdate());
+        try {
+          for (Destination destination : destinations.get().getAll(FilterType.ALL)) {
+            taskNamesByReplicateRefUpdate.putAll(destination.getTaskNamesByReplicateRefUpdate());
+          }
+        } catch (Throwable e) {
+          repLog.atWarning().withCause(e).log(
+              "Unexpected error while accumulating prunable replication tasks");
         }
       }
       new ChainedScheduler.StreamScheduler<>(