public function DatabaseQueue::delayItem in Drupal 10
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Queue/DatabaseQueue.php \Drupal\Core\Queue\DatabaseQueue::delayItem()
File
- core/lib/Drupal/Core/Queue/DatabaseQueue.php, line 177
Class
- DatabaseQueue
- Default queue implementation.
Namespace
Drupal\Core\Queue
Code
public function delayItem($item, int $delay) {
if ($delay < 0) {
throw new \InvalidArgumentException('$delay must be non-negative');
}
try {
$expire = \Drupal::time()
->getCurrentTime() + $delay;
$update = $this->connection
->update(static::TABLE_NAME)
->fields([
'expire' => $expire,
])
->condition('item_id', $item->item_id);
return (bool) $update
->execute();
} catch (\Exception $e) {
$this
->catchException($e);
return TRUE;
}
}