sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [sling-org-apache-sling-distribution-journal] cschneider commented on a change in pull request #45: SLING-9472 - Make Precondition return immediately
Date Tue, 30 Jun 2020 11:24:53 GMT

cschneider commented on a change in pull request #45:
URL: https://github.com/apache/sling-org-apache-sling-distribution-journal/pull/45#discussion_r447609318



##########
File path: src/main/java/org/apache/sling/distribution/journal/impl/subscriber/DistributionSubscriber.java
##########
@@ -371,4 +369,22 @@ private static void delay(long delayInMs) {
         }
     }
 
+    private Decision waitPrecondition(long offset) {
+        Decision decision = Precondition.Decision.WAIT;
+        long endTime = System.currentTimeMillis() + PRECONDITION_TIMEOUT * 1000;
+        while (decision == Decision.WAIT && System.currentTimeMillis() < endTime)
{
+            decision = precondition.canProcess(subAgentName, offset);
+            if (decision == Decision.WAIT) {
+                try {
+                    Thread.sleep(100);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    return Decision.SKIP;

Review comment:
       I first fixed with returning WAIT but actually throwing PreConditionTimeoutException
might make more sense. WDYT?




----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message