nl_tokens: Options for { @link TravisStatusQueryOptions } .
pl_tokens: function queryWithWait ( query , valueIsPending , options ) { const maxWaitMs = options && options . wait ? Number ( options . wait ) : 0 ; if ( Number . isNaN ( maxWaitMs ) ) { return Promise . reject ( new TypeError ( 'wait must be a number' ) ) ; } if ( maxWaitMs < 0 ) { return Promise . reject ( new RangeError ( 'wait must be non-negative' ) ) ; } const startMs = Date . now ( ) ; // Note:  Divide by 2 so we can double unconditionally below let nextWaitMs = POLL_TIME_START_MS / 2 ; function doQuery ( cb ) { query . get ( cb ) ; } return new Promise ( ( resolve , reject ) => { function checkBuild ( err , result ) { if ( err ) { reject ( err ) ; return ; } if ( maxWaitMs ) { let isPending ; try { isPending = valueIsPending ( result ) ; } catch ( errPending ) { reject ( errPending ) ; return ; } if ( isPending ) { const nowMs = Date . <mask> ( ) ; const totalWaitMs = nowMs - startMs ; if ( totalWaitMs < maxWaitMs ) { nextWaitMs = Math . min ( nextWaitMs * 2 , POLL_TIME_MAX_MS , maxWaitMs - totalWaitMs ) ; setTimeout ( doQuery , nextWaitMs , checkBuild ) ; return ; } } } resolve ( result ) ; } doQuery ( checkBuild ) ; } ) ; }