Cotal TypeScript packages
    Preparing search index...

    Function withDeadline

    • Race a link round trip against a deadline, and answer no if the deadline wins. The timer is deliberately NOT unref'd: it is the only thing keeping the process alive while we wait on a socket that will never answer, and an unref'd one lets node empty its loop and abort the whole command on a pending await instead of finishing the wait and printing why. It is cleared as soon as either side settles, so a healthy link is never held open for the remainder of the deadline.

      Parameters

      • work: Promise<boolean>
      • ms: number

      Returns Promise<boolean>