You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ga...@apache.org on 2019/08/05 09:04:17 UTC
[flink] branch release-1.8 updated: [FLINK-13508][tests] Prevent
waitUntilCondition() from sleeping negative time
This is an automated email from the ASF dual-hosted git repository.
gary pushed a commit to branch release-1.8
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.8 by this push:
new a0d236f [FLINK-13508][tests] Prevent waitUntilCondition() from sleeping negative time
a0d236f is described below
commit a0d236fba7c6abdabb461aa504b1e088a3982c31
Author: Gary Yao <ga...@apache.org>
AuthorDate: Wed Jul 31 13:41:42 2019 +0200
[FLINK-13508][tests] Prevent waitUntilCondition() from sleeping negative time
This fixes that CommonTestUtils#waitUntilCondition() may invoke Thread.sleep()
with a negative argument.
---
.../test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java b/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java
index da07dfd..6ae8b89 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/CommonTestUtils.java
@@ -160,7 +160,8 @@ public class CommonTestUtils {
public static void waitUntilCondition(SupplierWithException<Boolean, Exception> condition, Deadline timeout, long retryIntervalMillis) throws Exception {
while (timeout.hasTimeLeft() && !condition.get()) {
- Thread.sleep(Math.min(retryIntervalMillis, timeout.timeLeft().toMillis()));
+ final long timeLeft = Math.max(0, timeout.timeLeft().toMillis());
+ Thread.sleep(Math.min(retryIntervalMillis, timeLeft));
}
if (!timeout.hasTimeLeft()) {