-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
type: bugA general bugA general bug
Milestone
Description
Bug Report
Current Behavior
-
Delay.decorrelatedJitter()always returns the same value. If used with default setup - 0. -
I couldn't find any limitation on attempts in
ConnectionWatchdog, that's why I decided to testDelay.fullJitter()with a high number of attempts (100+). If I use any other value forbaseexcept the default one I getIllegalArgumentException: bound must be greater than origin.
Stack trace
Exception in thread "main" java.lang.IllegalArgumentException: bound must be greater than origin
at java.base/jdk.internal.util.random.RandomSupport.checkRange(RandomSupport.java:246)
at java.base/java.util.random.RandomGenerator.nextLong(RandomGenerator.java:739)
at java.base/java.util.concurrent.ThreadLocalRandom.nextLong(ThreadLocalRandom.java:484)
at io.lettuce.core.resource.Delay.randomBetween(Delay.java:331)
at io.lettuce.core.resource.FullJitterDelay.createDelay(FullJitterDelay.java:57)Input Code
decorrelatedJitter
Delay delay = Delay.decorrelatedJitter().get();
for (int i = 0; i < 10; i++) {
System.out.println(delay.createDelay(i).toMillis());
}fullJitter
var delay = Delay.fullJitter(Duration.ZERO, Duration.ofSeconds(30), 2, TimeUnit.MILLISECONDS);
for (int i = 0; i < 100; i++) {
System.out.println(delay.createDelay(i).toMillis());
}Expected behavior/code
Environment
- Lettuce version(s): 6.1.8.RELEASE
- Redis version: N/A
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug