sleep
sleep(ms) pauses execution for a specified duration. Async and yields the Lua VM, allowing other tasks to run while waiting.
Signature
Section titled “Signature”sleep(ms)
asyncParameters
Section titled “Parameters”| Param | Type | Description |
|---|---|---|
ms |
number | Duration to sleep in milliseconds |
Returns
Section titled “Returns”None.
Example
Section titled “Example”function before_fetch(request, ctx) -- Rate limiting: wait 2 seconds between requests sleep(2000) return requestendSee Also
Section titled “See Also”- before_fetch - Modify request before fetching