Copilot commented on code in PR #16447:
URL: https://github.com/apache/iotdb/pull/16447#discussion_r2362229328


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/resource/log/SubscriptionLogStatus.java:
##########
@@ -68,7 +68,7 @@ public Optional<Logger> schedule(final String 
consumerGroupId, final String topi
                         now
                             // introduce randomness
                             - BASE_INTERVAL_IN_MS
-                                * ThreadLocalRandom.current().nextLong(1, 
count + 1))));
+                                * 
ThreadLocalRandom.current().nextLong(Math.max(count, 1)))));

Review Comment:
   The fix changes the behavior from generating a random number in range [1, 
count+1) to [0, max(count,1)). When count > 0, this now generates values in [0, 
count) instead of [1, count+1), which may not preserve the intended logic. 
Consider using `nextLong(1, Math.max(count, 1) + 1)` to maintain the original 
range while fixing the bounds issue.
   ```suggestion
                                   * ThreadLocalRandom.current().nextLong(1, 
Math.max(count, 1) + 1)))));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to