However, the instant_to_tick can still calculate a u64 which is bigger than MAX_SAFE_MILLIS_DURATION.
Solution
Even if a u128 successfully try_into a u64, we still check whether it is bigger than MAX_SAFE_MILLIS_DURATION. If it is greater, we will return MAX_SAFE_MILLIS_DURATION.
Motivation
The https://github.com/tokio-rs/tokio/pull/5710 tried to fix the panic issue when the instance is very big.
However, the
instant_to_tick
can still calculate au64
which is bigger thanMAX_SAFE_MILLIS_DURATION
.Solution
Even if a
u128
successfully try_into au64
, we still check whether it is bigger thanMAX_SAFE_MILLIS_DURATION
. If it is greater, we will returnMAX_SAFE_MILLIS_DURATION
.