mohiaror commented on a change in pull request #49:
URL: 
https://github.com/apache/sling-org-apache-sling-distribution-core/pull/49#discussion_r594580822



##########
File path: 
src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java
##########
@@ -147,6 +147,9 @@ private boolean processQueueItem(String queueName, 
DistributionQueueEntry queueE
                 } catch (RecoverableDistributionException e) {
                     distributionLog.warn("[{}] PACKAGE-FAIL {}: could not 
deliver {}, {}", queueName, requestId, distributionPackage.getId(), 
e.getMessage());
                     distributionLog.debug("could not deliver package {}", 
distributionPackage.getId(), e);
+                    // since there is a recoverable error, it is possible that 
the same error is observed on the retry
+                    // we should add a linear backoff using random delay 
before re-attempting to distribute the same item.
+                    addRandomDelay(queueItemStatus.getAttempts());

Review comment:
       @actinium15 I thought you were suggesting to move this at the top of the 
inner try block (because of the catch block you added in the example code). The 
inner try block only tries to distribute a valid distribution package. However, 
we can add this delay (based on greater than zero retries) at the top of the 
outer try block. I will update the PR accordingly.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to