protected function ReliablePhpRedis::garbageCollection in Redis 8
Automatically release items, that have been claimed and exceeded lease time.
1 call to ReliablePhpRedis::garbageCollection()
- ReliablePhpRedis::claimItem in src/
Queue/ ReliablePhpRedis.php - Claims an item in the queue for processing.
File
- src/
Queue/ ReliablePhpRedis.php, line 142
Class
- ReliablePhpRedis
- Redis queue implementation using PhpRedis extension backend.
Namespace
Drupal\redis\QueueCode
protected function garbageCollection() {
foreach ($this->client
->lrange($this->claimedListKey, 0, -1) as $qid) {
if (!$this->client
->exists($this->leasedKeyPrefix . $qid)) {
// The lease expired for this ID.
$this->client
->multi()
->lrem($this->claimedListKey, $qid, -1)
->lpush($this->availableListKey, $qid)
->exec();
}
}
}