If request was shorter than max request time, delay
348865
def _delay_for_ratelimits(cls, start):
        """"""
        stop = datetime.now()
        duration_microseconds = (stop - start).microseconds
        if duration_microseconds < cls.REQUEST_TIME_MICROSECONDS:
            time.sleep((cls.REQUEST_TIME_MICROSECONDS - duration_microseconds)
                       / MICROSECONDS_PER_SECOND)
1047563
def format_delay(self, delay, limit, bucket, environ, start_response):
        

        # Set up the default status
        status = self.conf.status

        # Set up the retry-after header...
        headers = HeadersDict([('Retry-After', "%d" % math.ceil(delay))])

        # Let format fiddle with the headers
        status, entity = limit.format(status, headers, environ, bucket,
                                      delay)

        # Return the response
        start_response(status, headers.items())
        return entity
512291
function doSomethingUninteresting(data) {
  // simulate latency
  var wait = randomWait(1000);
  return Promise.delay(wait).then(
    () => `It took me ${wait} milliseconds to notice you gave me ${data}.`
  );
}
1110528
def _wait_for_result(self):
        """"""
        basetime = 0.018 if self._low_res else 0.128
        sleep(basetime * (self._mtreg / 69.0) + self._delay)
548731
def _delay(self, ms):
        
        if ms:
            self.Delay(ms)
        else:
            if self.default_delay:
                self.Delay(self.default_delay)
141973
def _handle_request(self, request):
        """"""
        if 'types' in self.method_data[request['method']]:
            self._validate_params_types(request['method'], request['params'])

        if self.serve_exception:
            raise self.serve_exception()
        d = self._call_method(request)
        self.pending.add(d)
        if self.timeout:
            timeout_deferred = self.reactor.callLater(self.timeout, d.cancel)

            def completed(result):
                if timeout_deferred.active():
                    # cancel the timeout_deferred if it has not been fired yet
                    # this is to prevent d's deferred chain from firing twice
                    # (and raising an exception).
                    timeout_deferred.cancel()
                return result
            d.addBoth(completed)
        try:
            result = yield d
        except defer.CancelledError:
            # The request was cancelled due to a timeout or by cancelPending
            # having been called. We return a TimeoutError to the client.
            self._remove_pending(d)
            raise TimeoutError()
        except Exception as e:
            self._remove_pending(d)
            raise e
        self._remove_pending(d)
        # Do not respond to notifications.
        if request['id'] is None:
            defer.returnValue(None)

        respond = {}
        self._fill_ver(request['jsonrpc'], respond)
        respond['result'] = result
        respond['id'] = request['id']

        defer.returnValue(respond)
576853
final void updateDelayInMillisecondsFrom(HttpResponse httpPollResponse) {
        final Long parsedDelayInMilliseconds = delayInMillisecondsFrom(httpPollResponse);
        if (parsedDelayInMilliseconds != null) {
            delayInMilliseconds = parsedDelayInMilliseconds;
        }
    }
631402
function throttle(func, delay) {
      var recent;
      return function throttled() {
        var context = this;
        var args = arguments;
        var now = $mdUtil.now();

        if (!recent || (now - recent > delay)) {
          func.apply(context, args);
          recent = now;
        }
      };
    }
198648
function getLongestDelay(delays) {
    var latest, lid;
    for(var id in delays) {
      var available = delays[id].available;
      if(!latest || available < latest) {
        latest = available;
        lid = id;
      }
    }

    return lid;
  }
1028237
def wait(self, timeout=None):
        """"""
        self._event.wait(timeout)
        return self._event.isSet()
1254935
void statsEndRequest(long duration,boolean ok)
    {
        synchronized(_statsLock)
        {
            _requests++;
            _requestsActive--;
            if (_requestsActive<0)
                _requestsActive=0;
            if (_requestsActive < _requestsActiveMin)
                _requestsActiveMin=_requestsActive;
            
            if (ok)
            {
                _requestsDurationTotal+=duration;
                if (_requestsDurationMin==0 || duration<_requestsDurationMin)
                    _requestsDurationMin=duration;
                if (duration>_requestsDurationMax)
                    _requestsDurationMax=duration;
            }
            else
                _errors++;
        }
    }
1055780
def delay(self):
        ''''''
        if self._last_checked:
            return self._interval - (time.time() - self._last_checked)
        return self._interval
1097520
public T waitForRequest(long maxWait) {
        long start = System.currentTimeMillis();
        try {
            while (requestsReceived.get() < 1
                    && (System.currentTimeMillis() - start) < maxWait) {
                try {
                    Thread.sleep(50);
                } catch (InterruptedException ex) {
                    throw new RuntimeException(ex);
                }
            }
        } finally {
            stopServer();
        }

        return getResponse();
    }
268790
def delay(self, params, now=None):
        """"""

        if now is None:
            now = time.time()

        # Initialize last...
        if not self.last:
            self.last = now
        elif now < self.last:
            now = self.last

        # How much has leaked out?
        leaked = now - self.last

        # Update the last message time
        self.last = now

        # Update the water level
        self.level = max(self.level - leaked, 0)

        # Are we too full?
        difference = self.level + self.limit.cost - self.limit.unit_value
        if difference >= self.eps:
            self.next = now + difference
            return difference

        # OK, raise the water level and set next to an appropriate
        # value
        self.level += self.limit.cost
        self.next = now

        return None
1243662
def _delay(self) -> int:
        """"""
        try:
            return int(self.journey.MainStop.BasicStop.Dep.Delay.text)
        except AttributeError:
            return 0
1297293
def idle_task(self):
        ''''''
        if self.current_request is None:
            return
        if time.time() - self.last_send_time < 0.2:
            # limit to 5 per second
            return
        self.send_terrain_data()
51950
function throttle(f, delay) {
  var timeoutId;
  var previous = 0;

  return function throttleExecute_() {
    var args = arguments;
    var now = +(new Date());
    var remaining = delay - (now - previous);

    if (remaining <= 0) {
      clearTimeout(timeoutId);
      timeoutId = null;
      previous = now;

      f.apply(null, args);
    } else if (!timeoutId) {
      timeoutId = setTimeout(function() {
        previous = +(new Date());
        timeoutId = null;

        f.apply(null, args);
      }, remaining);
    }
  };
}