Cyrill commented on code in PR #7287:
URL: https://github.com/apache/ignite-3/pull/7287#discussion_r2646229096
##########
modules/raft/src/main/java/org/apache/ignite/raft/jraft/util/Utils.java:
##########
@@ -341,6 +341,34 @@ public static long monotonicUs() {
return TimeUnit.NANOSECONDS.toMicros(System.nanoTime());
}
+ /**
+ * Computes a monotonic-time deadline based on the provided timeout.
+ *
+ * <p>The returned value is expressed in the same time domain as
+ * {@link Utils#monotonicMs()} and is intended for comparisons against
+ * that value (for example, {@code now >= deadline}).
+ *
+ * <p>Timeout semantics:
+ * <ul>
+ * <li>{@code timeoutMillis < 0} or {@code timeoutMillis ==
Long.MAX_VALUE}
+ * — the deadline is unbounded and {@code Long.MAX_VALUE} is
returned.</li>
+ * <li>{@code timeoutMillis >= 0} — the deadline is computed as
+ * {@code Utils.monotonicMs() + timeoutMillis}.</li>
+ * </ul>
+ *
+ * @param timeoutMillis timeout in milliseconds controlling the retry
window
+ * @return a monotonic-time deadline in milliseconds, or {@code
Long.MAX_VALUE}
+ * if retries are unbounded
+ */
+ public static long monotonicMsAfter(long timeoutMillis) {
Review Comment:
`IgniteUtils` is too generic for this method, I don't think many will need
to add to the monotonic time. Raft's utils is closer to the really used logic.
--
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]