Skip to content

Commit 39c3e07

Browse files
committed
Subscription: Prevent IllegalArgumentException in SubscriptionLogStatus by validating bounds for nextLong (#16447)
1 parent af30dba commit 39c3e07

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/resource/log/SubscriptionLogStatus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public Optional<Logger> schedule(final String consumerGroupId, final String topi
6868
now
6969
// introduce randomness
7070
- BASE_INTERVAL_IN_MS
71-
* ThreadLocalRandom.current().nextLong(1, count + 1))));
71+
* ThreadLocalRandom.current().nextLong(Math.max(count, 1)))));
7272
final long last = lastTime.get();
7373
if (now - last >= allowedInterval) {
7474
// Use compareAndSet to ensure that only one thread updates at a time,

0 commit comments

Comments
 (0)