sleep

sleep

sleep

Function

Let the current thread sleep for the specified number of milliseconds.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
millisIntNo0The number of milliseconds to sleep; negative numbers are treated as 0.

Return value

TypeDescription
EmptyReturn to Empty after sleeping.

Example

Notes

  • This function blocks the current execution flow.
  • Short sleep() is allowed in Web requests, but the number of dormant milliseconds cannot exceed BT_IO_TIMEOUT_MS, the default is 30000 milliseconds; the entire request script will enter the blocking pool to avoid blocking Tokio Web workers.
  • The complete rules in web requests are found in: Web Blocking API Policy.