arjun4084346 commented on a change in 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 With regards, Apache Git Services