public function cron($timeLimit = self::CRON_EXEC_TIME, $workerID = self::WORKER_ID)
    {
        $start = microtime(true);
        $workerID = $this->setWorkerID($workerID);
        $log = [];
        $lastCount = -1;
        while (count($log) > $lastCount &&
            (
                empty($timeLimit) ||
                $timeLimit > (microtime(true) - $start)
            )
        ) {
            $lastCount = count($log);
            $query = $this->pdo->prepare(<<<SQL
UPDATE robotstxt__cache1
SET worker = :workerID
WHERE worker IS NULL AND nextUpdate <= UNIX_TIMESTAMP()
ORDER BY nextUpdate ASC
LIMIT 1;
SQL
            );
            $query->bindValue('workerID', $workerID, \PDO::PARAM_INT);
            $query->execute();
            $query = $this->pdo->prepare(<<<SQL
SELECT base
FROM robotstxt__cache1
WHERE worker = :workerID
ORDER BY nextUpdate DESC
LIMIT 10;
SQL
            );
            $query->bindValue('workerID', $workerID, \PDO::PARAM_INT);
            $query->execute();
            while ($baseUri = $query->fetch(\PDO::FETCH_COLUMN)) {
                if ((new Base($this->pdo, $baseUri, $this->curlOptions, $this->byteLimit))->refresh()) {
                    $log[(string)microtime(true)] = $baseUri;
                }
            }
        }
        return $log;
    }
public function cron($timeLimit = self::CRON_EXEC_TIME, $workerID = self::WORKER_ID)
    {
        $start = microtime(true);
        $workerID = $this->setWorkerID($workerID);
        $log = [];
        $lastCount = -1;
        while (count($log) > $lastCount &&
            (
                empty($timeLimit) ||
                $timeLimit > (microtime(true) - $start)
            )
        ) {
            $lastCount = count($log);
            $query = $this->pdo->prepare(<<<SQL
UPDATE robotstxt__cache1
SET worker = :workerID
WHERE worker IS NULL AND nextUpdate <= UNIX_TIMESTAMP()
ORDER BY nextUpdate ASC
LIMIT 1;
SQL
            );
            $query->bindValue('workerID', $workerID, \PDO::PARAM_INT);
            $query->execute();
            $query = $this->pdo->prepare(<<<SQL
SELECT base
FROM robotstxt__cache1
WHERE worker = :workerID
ORDER BY nextUpdate DESC
LIMIT 10;
SQL
            );
            $query->bindValue('workerID', $workerID, \PDO::PARAM_INT);
            $query->execute();
            while ($baseUri = $query->fetch(\PDO::FETCH_COLUMN)) {
                if ((new Base($this->pdo, $baseUri, $this->curlOptions, $this->byteLimit))->refresh()) {
                    $log[(string)microtime(true)] = $baseUri;
                }
            }
        }
        return $log;
    }
public function cron ( $ timeLimit = self :: CRON_EXEC_TIME , $ workerID = self :: WORKER_ID ) { $ start = microtime ( true ) ; $ workerID = $ this -> setWorkerID ( $ workerID ) ; $ log = [ ] ; $ lastCount = - 1 ; while ( count ( $ log ) > $ lastCount && ( empty ( $ timeLimit ) || $ timeLimit > ( microtime ( true ) - $ start ) ) ) { $ lastCount = count ( $ log ) ; $ query = $ this -> pdo -> prepare ( <<<SQL
UPDATE robotstxt__cache1
SET worker = :workerID
WHERE worker IS NULL AND nextUpdate <= UNIX_TIMESTAMP()
ORDER BY nextUpdate ASC
LIMIT 1;
SQL ) ; $ query -> bindValue ( 'workerID' , $ workerID , \ PDO :: PARAM_INT ) ; $ query -> execute ( ) ; $ query = $ this -> pdo -> prepare ( <<<SQL
SELECT base
FROM robotstxt__cache1
WHERE worker = :workerID
ORDER BY nextUpdate DESC
LIMIT 10;
SQL ) ; $ query -> bindValue ( 'workerID' , $ workerID , \ PDO :: PARAM_INT ) ; $ query -> execute ( ) ; while ( $ baseUri = $ query -> fetch ( \ PDO :: FETCH_COLUMN ) ) { if ( ( new Base ( $ this -> pdo , $ baseUri , $ this -> curlOptions , $ this -> byteLimit ) ) -> refresh ( ) ) { $ log [ ( string ) microtime ( true ) ] = $ baseUri ; } } } return $ log ; }
Process the update queue

@param float|int $timeLimit
@param int|null $workerID
@return string[]
@throws Exceptions\DatabaseException
Process the update queue