[ 
https://issues.apache.org/jira/browse/GOBBLIN-1068?focusedWorklogId=417582&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-417582
 ]

ASF GitHub Bot logged work on GOBBLIN-1068:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Apr/20 09:25
            Start Date: 07/Apr/20 09:25
    Worklog Time Spent: 10m 
      Work Description: arjun4084346 commented on pull request #2907: 
[GOBBLIN-1068]Clean up cyclic logic in task cancellation
URL: https://github.com/apache/incubator-gobblin/pull/2907#discussion_r404661941
 
 

 ##########
 File path: 
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SleepingTask.java
 ##########
 @@ -64,19 +70,27 @@ public void run() {
         throw new IOException("File creation error: " + 
taskStateFile.getName());
       }
       long endTime = System.currentTimeMillis() + sleepTime * 1000;
-      while (System.currentTimeMillis() <= endTime) {
-        Thread.sleep(1000L);
-        log.warn("Sleeping for {} seconds", sleepTime);
-      }
+
+      
AssertWithBackoff.create().maxSleepMs(1000).timeoutMs(Integer.MAX_VALUE).backoffFactor(1).
 
 Review comment:
   What's the point of giving timeoutMs(Integer.MAX_VALUE) ?
   
   I think AssertWithBackoff should be used in place of Thread.Sleep when 
sleeping time is not known, e.g. when we are expecting for something to be true 
(or something to happen), but do not know when that will happen, and at the 
same time we do not want to sleep for a fixed amount of time which could be 1) 
too big, which would delay build, or 2) too small , that what we were expecting 
did not happen in that time.
   
   I know AssertWithBackoff is recommended in Gobblin team, but in this case, 
sleep time is fixed. AssertWithBackoff makes no sense here. 
 
----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 417582)
    Time Spent: 3h 10m  (was: 3h)

> Clean cyclic logic in task cancellation in Gobblin Task
> -------------------------------------------------------
>
>                 Key: GOBBLIN-1068
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1068
>             Project: Apache Gobblin
>          Issue Type: Bug
>            Reporter: Lei Sun
>            Priority: Major
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>




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

Reply via email to