[#1959] Proposed fix to correctly handle timeouts that overflow the ticks in the wheel
This commit is contained in:
parent
6d436948a7
commit
fb6d301090
@ -506,9 +506,10 @@ public class HashedWheelTimer implements Timer {
|
|||||||
this.task = task;
|
this.task = task;
|
||||||
this.deadline = deadline;
|
this.deadline = deadline;
|
||||||
|
|
||||||
final long ticks = Math.max(deadline / tickDuration, tick); // Ensure we don't schedule for past.
|
long calculated = deadline / tickDuration;
|
||||||
|
final long ticks = Math.max(calculated, tick); // Ensure we don't schedule for past.
|
||||||
stopIndex = (int) (ticks & mask);
|
stopIndex = (int) (ticks & mask);
|
||||||
remainingRounds = ticks / wheel.length;
|
remainingRounds = (calculated - tick) / wheel.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Timer getTimer() {
|
public Timer getTimer() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user