summaryrefslogtreecommitdiffstats
path: root/jrt
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2019-07-01 13:56:28 +0000
committerHåvard Pettersen <havardpe@oath.com>2019-07-01 13:56:28 +0000
commit18384705a5e7426a2c808a37f3c1e216dcb6ebd4 (patch)
treeaaca2134c8b52b40cfe3409370644f51e285ee9b /jrt
parentdd76185fd1639d22393d600a248b18b44ad534aa (diff)
round -> ceil to avoid premature timeout
in the cases where the timeout is not divisible by the tick size.
Diffstat (limited to 'jrt')
-rw-r--r--jrt/src/com/yahoo/jrt/Scheduler.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/jrt/src/com/yahoo/jrt/Scheduler.java b/jrt/src/com/yahoo/jrt/Scheduler.java
index 57b5ac43cea..ae5a827076e 100644
--- a/jrt/src/com/yahoo/jrt/Scheduler.java
+++ b/jrt/src/com/yahoo/jrt/Scheduler.java
@@ -61,7 +61,7 @@ class Scheduler {
if (seconds < 0.0) {
throw new IllegalArgumentException("cannot schedule a Task in the past");
}
- int ticks = 1 + (int) (seconds * 10.0 + 0.5);
+ int ticks = 1 + (int) Math.ceil(seconds * (1000.0 / TICK));
if (isActive(task)) {
linkOut(task);
}