reactor-core icon indicating copy to clipboard operation
reactor-core copied to clipboard

Fix elapsed time computation in OptimisticEmitFailureHandler

Open bjmi opened this issue 3 months ago • 0 comments

This change addresses the elapsed time computation in OptimisticEmitFailureHandler due to the possibility of a numerical overflow. The described behavior isn't changed from user's perspective.

Javadoc of System.nanoTime() explicitly mentions how to measure elapsed time.

To compare elapsed time against a timeout, use if (System.nanoTime() - startTime >= timeoutNanos) ... instead of if (System.nanoTime() >= startTime + timeoutNanos) ... because of the possibility of numerical overflow.

See System.nanoTime()

bjmi avatar Oct 08 '25 04:10 bjmi