public function RedisQueueTest::testRedisNonBlockingQueue in Redis 8
Tests Redis non-blocking queue.
File
- tests/
src/ Kernel/ RedisQueueTest.php, line 28
Class
- RedisQueueTest
- Tests the Redis queue functions.
Namespace
Drupal\Tests\redis\KernelCode
public function testRedisNonBlockingQueue() {
self::setUpSettings();
$client_factory = \Drupal::service('redis.factory');
$settings = [
'reserve_timeout' => NULL,
];
$class_name = $client_factory
->getClass(ClientFactory::REDIS_IMPL_QUEUE);
/** @var \Drupal\Core\Queue\QueueInterface $queue1 */
$queue1 = new $class_name($this
->randomMachineName(), $settings, $client_factory
->getClient());
$queue1
->createQueue();
/** @var \Drupal\Core\Queue\QueueInterface $queue2 */
$queue2 = new $class_name($this
->randomMachineName(), $settings, $client_factory
->getClient());
$queue2
->createQueue();
$this
->runQueueTest($queue1, $queue2);
$queue1
->deleteQueue();
$queue2
->deleteQueue();
$class_name = $client_factory
->getClass(ClientFactory::REDIS_IMPL_RELIABLE_QUEUE);
/** @var \Drupal\Core\Queue\QueueInterface $queue1 */
$queue1 = new $class_name($this
->randomMachineName(), $settings, $client_factory
->getClient());
$queue1
->createQueue();
/** @var \Drupal\Core\Queue\QueueInterface $queue2 */
$queue2 = new $class_name($this
->randomMachineName(), $settings, $client_factory
->getClient());
$queue2
->createQueue();
$this
->runQueueTest($queue1, $queue2);
}