Amp\Promise\timeout

function timeout(Amp\Promise|React\Promise\PromiseInterface $promise, int $timeout): Amp\Promise

Creates an artificial timeout for any Promise.

If the timeout expires before the promise is resolved, the returned promise fails with an instance of Amp\TimeoutException.

Type Parameter Description Default Value
Amp\Promise|React\Promise\PromiseInterface $promise Promise to which the timeout is applied. none
int $timeout Timeout in milliseconds. none