Cron expression scheduling might be triggered 1 millisecond earlier #30666
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: regression
A bug that is also a regression
Milestone
Affects: 6.0.8
The issue just like the title described, after I look into the code, I found the calculation of the delay time in ReschedulingRunnable might cause the issue.
Above calculation of initialDelay keeps the nanosecond part, and truncate them at last in initialDelay.toMillis(). The next execution time of cron expression accurate to seconds, and current time has nanoseconds, that will make the initialDelay.toMillis() 1 millisecond less. If the execution fast enough the current time that is obtained in task will earlier than next execution time of cron expression.
Compare to 5.3.27
The nanoseconds has been truncated before the calculation of duration, that will make sure you can't got a unexpected current time.
The text was updated successfully, but these errors were encountered: