@param int $waitTime

@return mixed
438358
protected function cap($waitTime)
    {
        return is_int($this->getWaitCap())
            ? min($this->getWaitCap(), $waitTime)
            : $waitTime;
    }
998079
public function acquireLock( $key, $waitTime, $maxTime )
    {
        if ( strlen( $key ) > self::MAX_KEY_LENGTH )
        {
            throw new ezcCacheInvalidKeyException( $key, 'Length > ' . self::MAX_KEY_LENGTH . '.' );
        }

        // add() does not replace and returns true on success. $maxTime is
        // obeyed by Memcache expiry.
        while ( $this->memcache->add( $key, $key, false, $maxTime ) === false )
        {
            // Wait for next check
            usleep( $waitTime );
        }
    }
155213
protected function _getUTCDate($time = null)
    {
        if ($time instanceof DateTimeInterface) {
            $result = clone $time;
        } elseif (is_int($time)) {
            $result = new DateTime(date('Y-m-d H:i:s', $time));
        } else {
            $result = new DateTime($time);
        }

        return $result->setTimezone(new DateTimeZone('UTC'));
    }
1014473
private function getWaitInterval()
    {
        if ($this->queuer instanceof QueueInterface) {
            $waitTime = $this->iterationsWithOutTask * self::WAIT_INTERVAL;

            return min($waitTime, self::MAX_SLEEPING_TIME_FOR_DEDICATED_QUEUE);
        } else if ($this->queuer instanceof QueueDispatcherInterface) {
            return (int) $this->queuer->getWaitTime();
        } else {
            return self::WAIT_INTERVAL;
        }
    }
1327635
public function wait($timeout = 60)
    {
        $timeoutMicro = $timeout !== null ? microtime(true) + (float)$timeout : null;
        while ($this->isRunning()) {
            if ($timeout !== null && microtime(true) >= $timeoutMicro) {
                return null;
            }
            usleep(1000);
        }

        return $this->getExitCode();
    }
84684
public function wait($quantity = 0)
    {
        $count = 0;
        $info  = stream_get_meta_data($this->streamSocket);
        while (is_resource($this->streamSocket) === true && feof($this->streamSocket) === false && empty($info['timed_out']) === true) {
            $line = $this->receive();

            if ($line === false) {
                return null;
            }

            if (strpos($line, 'PING') === 0) {
                $this->handlePING();
            }

            if (strpos($line, 'MSG') === 0) {
                $count++;
                $this->handleMSG($line);
                if (($quantity !== 0) && ($count >= $quantity)) {
                    return $this;
                }
            }

            $info = stream_get_meta_data($this->streamSocket);
        }

        $this->close();

        return $this;
    }
572891
public function getResponseParam($param) {
    if (isset($this->notifyParams[$param])) {
      return $this->notifyParams[$param];
    }
    return NULL;
  }
1276142
public function tidyInternal($datetime)
    {
        if (!$datetime) {
            return null;
        }
        // Re-run through formatter to tidy up (e.g. remove time component)
        $formatter = $this->getInternalFormatter();
        $timestamp = $formatter->parse($datetime);
        if ($timestamp === false) {
            // Fallback to strtotime
            $timestamp = strtotime($datetime, DBDatetime::now()->getTimestamp());
            if ($timestamp === false) {
                return null;
            }
        }
        return $formatter->format($timestamp);
    }
1245708
public function getValue($timestamp = null)
    {
        $values = $this->determine(is_int($timestamp) ? $timestamp : time());
        if (count($values) > 0 &&
            ($rate = max($values)) > 0
        ) {
            return $rate;
        }
        return $this->fallbackValue;
    }
282644
public function pauseQueueTemporary($time)
    {
        $url = $this->buildUrl('config', [
            'name'  => 'set_pause',
            'value' => $time

        ]);
        $request = $this->guzzle->request('GET', $url);

        return json_decode($request->getBody(), true)['status'];
    }
1371094
public function findInvalid($datetime = null)
    {
        $datetime = (null === $datetime) ? new \DateTime() : $datetime;

        return $this->createQueryBuilder('u')
            ->where('u.valid < :datetime')
            ->setParameter(':datetime', $datetime)
            ->getQuery()
            ->getResult();
    }
325032
public function retry($backOffTime = null)
    {
        $retry = $this->getRetry();

        // Log the retry
        $this->queue->getClient()->getRedis()->hset(\date('Y-m-d') . '_retry', (string)\time(), \json_encode([
            'class' => $this->getWorkerClass(),
            'args' => $this->getArgs(),
            'retry' => \gettype($retry) === 'boolean' ? (bool)$retry : (int)($retry - 1),
            'priority' => (float)$this->getPriority(),
            'id' => $this->getId()
        ]));

        return $this->queue->push(
            $this->getWorkerClass(),
            $this->getArgs(),
            \gettype($retry) === 'boolean' ? (bool)$retry : (int)($retry - 1),
            (float)$this->getPriority(),
            \time() + $backOffTime ?? 0,
            $this->getId()
        );
    }
1062278
public function find($callable = null)
    {
        /** @var Cursor $cursor */
        $cursor = new Cursor($this, array(
            'expressionClass'   => $this->definition->getExpressionClass(),
            'batchSize'         => $this->definition->getOption('batchSize'),
            'clientTimeout'     => $this->definition->getOption('cursorClientTimeout'),
            'serverTimeout'     => $this->definition->getOption('cursorServerTimeout'),
        ));

        if (is_callable($callable)) {
            $callable($cursor->getExpression());
        }

        return $cursor;
    }
1034097
private function getWaitInterval()
    {
        if ($this->dedicatedQueue instanceof QueueInterface) {
            $waitTime = $this->iterationsWithOutTask * self::WAIT_INTERVAL;

            return min($waitTime, self::MAX_SLEEPING_TIME_FOR_DEDICATED_QUEUE);
        } else {
            return (int) $this->queueService->getWaitTime();
        }
    }
572247
public function get()
    {
        $processes = $this->processes();

        return collect($this->waitTime->calculate())
            ->map(function ($waitTime, $queue) use ($processes) {
                [$connection, $queueName] = explode(':', $queue, 2);

                $length = ! Str::contains($queue, ',')
                    ? $this->queue->connection($connection)->readyNow($queueName)
                    : collect(explode(',', $queueName))->sum(function ($queueName) use ($connection) {
                        return $this->queue->connection($connection)->readyNow($queueName);
                    });

                return [
                    'name' => $queueName,
                    'length' => $length,
                    'wait' => $waitTime,
                    'processes' => $processes[$queue] ?? 0,
                ];
            })->values()->toArray();
    }
647112
public function validateDateTime($dateTime) {
        $return = [];

        if (!empty($dateTime)) {

            $escapedDateTime = str_replace(['  ', '   ', '    '], ' ', $dateTime);

            $aDateTime = explode(" ", $escapedDateTime);

            if (count($aDateTime) > 1) {
                $date = $aDateTime[0];
                $time = $aDateTime[1];

                $dateFormat = str_replace(['/', '-', '.'], '-', $date);

                if (preg_match('/^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $dateFormat)) {
                    $format = 'Y-m-d';
                } else if (preg_match('/^(0[1-9]|[1-2][0-9]|3[0-1])-(0[1-9]|1[0-2])-([0-9]{4})$/', $dateFormat)) {
                    $format = 'd-m-Y';
                } else if (preg_match('/^(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])-([0-9]{4})$/', $dateFormat)) {
                    $format = 'm-d-Y';
                } else {
                    $format = null;
                }

                $return['date'] = $this->validateDate($dateFormat, $format);
                $return['time'] = $this->validateTime($time);
            } else {
                $return['date'] = false;
                $return['time'] = false;
            }
        } else {
            $return['date'] = false;
            $return['time'] = false;
        }

        if ($return['date'] and $return['time']) {
            $return['datetime'] = true;
        } else {
            $return['datetime'] = false;
        }

        return $return;
    }
1245356
@Override
    public T waitTime(long time, TimeUnit unit) {
        return perform(new WaitTimeInteraction(new Duration(time, unit)));
    }