You are here

public function MemoryLimitDatabaseQueue::__construct in Acquia Content Hub 8

Constructs \Drupal\acquia_contenthub\Queue\MemoryLimitDatabaseQueue.

Parameters

string $name: The name of the queue.

\Drupal\Core\Database\Connection $connection: The Connection object containing the key-value tables.

Overrides DatabaseQueue::__construct

File

src/Queue/MemoryLimitDatabaseQueue.php, line 32

Class

MemoryLimitDatabaseQueue
Overridden queue implementation that evaluates memory usage.

Namespace

Drupal\acquia_contenthub\Queue

Code

public function __construct($name, Connection $connection) {

  // Record the memory limit in bytes.
  $limit = trim(ini_get('memory_limit'));
  if ($limit == '-1') {
    $this->memoryLimit = PHP_INT_MAX;
  }
  else {
    $this->memoryLimit = Bytes::toInt($limit);
  }
  parent::__construct($name, $connection);
}