Override to check for timeout
160928
def check_precondition(self, key, value):
        '''
        
        '''
        timeout = float(value)
        curr_time = self.get_current_time()
        if curr_time > timeout:
            return True
        return False
185749
def timeout(seconds, error_message=None):
    """"""

    def decorated(func):
        result = ""

        def _handle_timeout(signum, frame):
            errmsg = error_message or 'Timeout: The action <%s> is timeout!' % func.__name__
            global result
            result = None
            import inspect
            stack_frame = inspect.stack()[4]
            file_name = os.path.basename(stack_frame[1])
            line_no = stack_frame[2]
            method_name = stack_frame[3]
            code_text = ','.join(stack_frame[4])
            stack_info = 'Stack: %s, %s:%s >%s' % (method_name, file_name, line_no, code_text)
            sys.stderr.write(errmsg+'\n')
            sys.stderr.write(stack_info+'\n')
            raise TimeoutError(errmsg)

        @sysx.platform(sysx.UNIX_LIKE, case_false_wraps=func)
        def wrapper(*args, **kwargs):
            global result
            signal.signal(signal.SIGALRM, _handle_timeout)
            signal.alarm(seconds)

            try:
                result = func(*args, **kwargs)
            finally:
                signal.alarm(0)
                return result

        return functools.wraps(func)(wrapper)

    return decorated
278773
def _raise_timeout(self, err, url, timeout_value):
        """"""

        if isinstance(err, SocketTimeout):
            raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)

        # See the above comment about EAGAIN in Python 3. In Python 2 we have
        # to specifically catch it and throw the timeout error
        if hasattr(err, 'errno') and err.errno in _blocking_errnos:
            raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)

        # Catch possible read timeouts thrown as SSL errors. If not the
        # case, rethrow the original. We need to do this because of:
        # http://bugs.python.org/issue10272
        if 'timed out' in str(err) or 'did not complete (read)' in str(err):  # Python < 2.7.4
            raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
8012
function t(time, done) {
  if (arguments.length === 1) {
    done = time;
    time = 2000;
  }
  var error = new Error(`Callback took too long (max: ${time})`);
  var waiting = true;

  var timeout = setTimeout(function () {
    if (!waiting) return;
    waiting = false;
    done(error);
  }, time);

  function handler() {
    if (!waiting) return;
    clearTimeout(timeout);
    waiting = false;
    done.apply(this, arguments);
  }

  return handler;
}
162984
private void parseReadTimeout(Map<Object, Object> props) {
        Object value = props.get(HttpConfigConstants.PROPNAME_READ_TIMEOUT);
        if (null != value) {
            try {
                this.readTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Config: Read timeout is " + getReadTimeout());
                }
            } catch (NumberFormatException nfe) {
                FFDCFilter.processException(nfe, getClass().getName() + ".parseReadTimeout", "1");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                    Tr.event(tc, "Config: Invalid read timeout; " + value);
                }
            }
        }
    }
1346997
public void checkForTimeouts(long checkTime) {
        TimeSlot nextSlot = this.firstSlot;
        TimerWorkItem entry = null;
        TimeSlot oldSlot = null;

        while (nextSlot != null && checkTime >= nextSlot.timeoutTime) {
            // Timeout all entries here
            int endIndex = nextSlot.lastEntryIndex;
            for (int i = 0; i <= endIndex; i++) {
                // invoke callback if not already cancelled
                entry = nextSlot.entries[i];

                if (entry.state == TimerWorkItem.ENTRY_ACTIVE) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Found a timeout, calling timerTriggered");
                    }
                    entry.state = TimerWorkItem.ENTRY_CANCELLED;
                    entry.callback.timerTriggered(entry);
                }
            }

            // since we timed out all slot entries, remove it
            oldSlot = nextSlot;
            removeSlot(oldSlot);
            nextSlot = nextSlot.nextEntry;
        }
    }
209763
def _declareTimeoutExceeded(self, ev_data: UpgradeLogData):
        
        logger.info("Timeout exceeded for {}:{}"
                    .format(ev_data.when, ev_data.version))
        last = self._actionLog.last_event
        # TODO test this
        if (last and last.ev_type == UpgradeLog.Events.failed and
                last.data == ev_data):
            return None

        self._action_failed(ev_data, reason="exceeded upgrade timeout")

        self._unscheduleAction()
        self._actionFailedCallback()
905326
def retry_timeout(api, retries=3):
    """"""
    @wraps(api)
    def retry_api(*args, **kwargs):
        """Retrying API."""
        for i in range(1, retries + 1):
            try:
                return api(*args, **kwargs)
            except RequestTimeout:
                if i == retries:
                    raise

    return retry_api
894494
def check(self):
        
        try:
            self.join(timeout=0)
        except Exception as e:
            logger.exception(e)
            raise
1232106
def wait_gone(self, timeout=None, raise_error=True):
        
        start_time = time.time()
        if timeout is None or timeout <= 0:
            timeout = self.timeout
        while start_time + timeout > time.time():
            if not self.exists:
                return True
        if not raise_error:
            return False
        raise WDAElementNotDisappearError("element not gone")
782006
def _on_timeout(self, info: str = None) -> None:
        
        self._timeout = None
        error_message = "Timeout {0}".format(info) if info else "Timeout"
        if self.final_callback is not None:
            self._handle_exception(
                HTTPTimeoutError, HTTPTimeoutError(error_message), None
            )
540792
def timeout(self, value):
        """"""
        self.check_pyb()
        try:
            self.pyb.serial.timeout = value
        except:
            # timeout is a property so it calls code, and that can fail
            # if the serial port is closed.
            pass
812093
def on_timeout(limit, handler=handler_func, hint=None):
    
    def notify_handler(signum, frame):
        handler("'%s' is not finished in %d second(s)." % (hint, limit))

    def __decorator(function):
        def __wrapper(*args, **kwargs):
            import signal
            signal.signal(signal.SIGALRM, notify_handler)
            signal.alarm(limit)
            result = function(*args, **kwargs)
            signal.alarm(0)
            return result
        return wraps(function)(__wrapper)
    return __decorator
225268
function( timeout, callback ) {
			if ( typeof timeout === 'function' ) {
				callback = timeout;
				timeout = null;
			}
			timeout = timeout || 600;
			var self = this;
			this.queue.unshift(function() {
				setTimeout(function() {
					callback && callback.apply(self, [])
					self.done.apply(self, arguments);
				}, timeout);
			});
			return this;
		}
1116792
function ConnectionTimeoutError(timeout) {
    Error.call(this);
    Error.captureStackTrace(this, this.constructor);
    this.message = 'connection timed out';

    if (timeout) {
        this.message += '. timeout = ' + timeout + ' ms';
    }

    this.name = 'ConnectionTimeoutError';
}
113529
public void setTimeout(Duration timeout) {

        LettuceAssert.notNull(timeout, "Timeout must not be null");
        LettuceAssert.isTrue(!timeout.isNegative(), "Timeout must be greater or equal 0");

        this.timeout = timeout;
    }
92099
protected void handleTimeout(REQID rid) {
    if (contextMap.containsKey(rid)) {
      Object ctx = contextMap.get(rid);
      contextMap.remove(rid);
      responseMessageMap.remove(rid);
      onResponse(StatusCode.TIMEOUT_ERROR, ctx, null);
    } else {
      // Since we dont do cancel timer, this is because we already have
      // the response. So just disregard this timeout
      // TODO:- implement cancel timer to avoid this overhead
    }
  }