[ 
https://issues.apache.org/jira/browse/SLING-10123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17290925#comment-17290925
 ] 

Mohit Arora edited comment on SLING-10123 at 3/1/21, 8:39 PM:
--------------------------------------------------------------

[~ashishc], [~marett], should we implement an ExponentialBackoff similar to [0] 
or would a simple Thread.sleep() for a specified time (linear backoff) be 
sufficient? If we want to use [0], would it make sense to extract it out into a 
common bundle which both distribution-journal and distribution-core are 
importing?

Just to add to this, I think exponential backoff might be an overkill 
here..mainly because we are not going to limit the reattempts. We can, in 
theory, have infinite attempts to deliver the queue item (for example, the 
endpoint is unreachable). Which means even if we implement an exponential 
backoff, we will have to define a limit and then start over again. This could 
be over-engineering, unless I am missing a very good reason to use exponential 
backoff here.

[0] 
https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/shared/ExponentialBackOff.java


was (Author: mohiaror):
[~ashishc], [~marett], should we implement an ExponentialBackoff similar to [0] 
or would a simple Thread.sleep() for a specified time (linear backoff) be 
sufficient? If we want to use [0], would it make sense to extract it out into a 
common bundle which both distribution-journal and distribution-core are 
importing?

[0] 
https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/shared/ExponentialBackOff.java

> Distribution agent queue processor should implement a backoff in case of 
> retries for processing an item
> -------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-10123
>                 URL: https://issues.apache.org/jira/browse/SLING-10123
>             Project: Sling
>          Issue Type: Bug
>          Components: Content Distribution
>    Affects Versions: Content Distribution Core 0.4.2
>            Reporter: Mohit Arora
>            Priority: Major
>             Fix For: Content Distribution Core 0.4.6
>
>
> In case of recoverable exceptions, distribution agent queue processor does 
> not evict the queue item from the processing queue [0]. Rather, the item is 
> retried infinitely until either the distribution of the item is successful or 
> a non-recoverable exception is thrown for the item. However, since there is 
> "something wrong" because of which an exception is thrown in the first place, 
> we should add a cool off period before trying to reattempt to distribute the 
> same item. This can be achieved through a linear or exponential backoff.
> cc - [~ashishc]
> [0] 
> https://github.com/apache/sling-org-apache-sling-distribution-core/blob/master/src/main/java/org/apache/sling/distribution/agent/impl/SimpleDistributionAgentQueueProcessor.java#L147-L150



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to