mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-24 00:00:11 +02:00
time: document maximum sleep duration (#3126)
This commit is contained in:
@@ -31,6 +31,8 @@ pub fn sleep_until(deadline: Instant) -> Sleep {
|
||||
///
|
||||
/// To run something regularly on a schedule, see [`interval`].
|
||||
///
|
||||
/// The maximum duration for a sleep is 68719476734 milliseconds (approximately 2.2 years).
|
||||
///
|
||||
/// # Cancellation
|
||||
///
|
||||
/// Canceling a sleep instance is done by dropping the returned future. No additional
|
||||
|
||||
@@ -182,6 +182,7 @@ const MAX_DURATION: u64 = (1 << (6 * NUM_LEVELS)) - 1;
|
||||
#[tokio::test]
|
||||
async fn exactly_max() {
|
||||
// TODO: this should not panic but `time::ms()` is acting up
|
||||
// If fixed, make sure to update documentation on `time::sleep` too.
|
||||
time::sleep(ms(MAX_DURATION)).await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user