synchronizePendingEvents: Fix stuck replaying flag Similar to change I4628a574, the replaying flag has a chance to become stuck as true if an exception is thrown while accumulating prunable replication tasks, which happens before the earlier fix is relevant. Catch and log the exception and continue since synchronizing with a subset of prunable tasks isn't much of a problem. Change-Id: I935c3252e8c3da63ac248b051380558b749ea76e Release-Notes: Fixed chance for exceptions to block future distributor runs
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 aa00634..4b5d7c1 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java
@@ -225,8 +225,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<>(