Aller au contenu principal

timeout

Callable


  • Creates a task that will reject a TimeoutError if task is not resolved or rejected within delay If timeout is omitted, the task is returned unchanged

    const longTask = Time.delay(TimeDuration({ hours: 1 }));
    const timeoutTask = timeout(longTask, TimeDuration(4));
    Task.run(timeoutTask); // Result.Error(TimeoutError({ message: 'Task timed out after 4ms', delay: 4 }))
    // Note that `longTask` will be canceled and will never resolve nor reject