This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit b1dec0431cf4cf5f9865ae033e23a065c98638fe Author: Benoit TELLIER <[email protected]> AuthorDate: Thu Jan 8 09:40:05 2026 +0100 Small fix for WaitDelay generator --- .../src/main/java/org/apache/james/events/WaitDelayGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/event-bus/distributed/src/main/java/org/apache/james/events/WaitDelayGenerator.java b/event-bus/distributed/src/main/java/org/apache/james/events/WaitDelayGenerator.java index e12eb65716..01f23b010b 100644 --- a/event-bus/distributed/src/main/java/org/apache/james/events/WaitDelayGenerator.java +++ b/event-bus/distributed/src/main/java/org/apache/james/events/WaitDelayGenerator.java @@ -37,10 +37,10 @@ class WaitDelayGenerator { private static Duration randomBetween(Duration base, Duration jitter) { Preconditions.checkArgument(!jitter.isNegative(), "jitter value should always be positive"); - if (jitter.isZero()) { + long maxJitterAsMillis = jitter.toMillis(); + if (maxJitterAsMillis <= 0) { return base; } - long maxJitterAsMillis = jitter.toMillis(); long jitterAsMillis = SECURE_RANDOM.nextInt(Ints.checkedCast(maxJitterAsMillis * 2)) / 2; return base.plusMillis(jitterAsMillis); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
