From b34f0750f733bf7012b99db3cc5f82b154ea87a6 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 2 May 2023 15:14:45 +0200 Subject: If you start lagging behind, always prefer timing out as that will be good for all. --- .../src/main/java/com/yahoo/jdisc/core/ScheduledQueue.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'jdisc_core/src/main/java/com/yahoo/jdisc/core/ScheduledQueue.java') diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ScheduledQueue.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ScheduledQueue.java index 09483a7c7e5..881ccebdb93 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ScheduledQueue.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ScheduledQueue.java @@ -12,7 +12,6 @@ class ScheduledQueue { public static final int MILLIS_PER_SLOT = 100; public static final int NUM_SLOTS = 512; - public static final int NUM_SLOTS_UNDILATED = 3; public static final int SLOT_MASK = 511; // bitmask to modulo NUM_SLOTS public static final int ITER_SHIFT = 9; // number of bits to shift off SLOT_MASK @@ -38,13 +37,11 @@ class ScheduledQueue { int queueSize = queueSize() + out.size(); drainTo(NUM_SLOTS, 0, out); for (int i = 0; currentTimeMillis >= nextTick && (queueSize > out.size()); i++, nextTick += MILLIS_PER_SLOT) { - if (i < NUM_SLOTS_UNDILATED) { - if (++currSlot >= NUM_SLOTS) { - currSlot = 0; - currIter++; - } - drainTo(currSlot, currIter, out); + if (++currSlot >= NUM_SLOTS) { + currSlot = 0; + currIter++; } + drainTo(currSlot, currIter, out); } } -- cgit v1.2.3