Improve redis queue handling of error

This commit is contained in:
osaajani 2025-08-27 18:59:52 +02:00
parent 08cbb0f12e
commit 9e2bd47e34

View file

@ -86,6 +86,9 @@ class RedisQueue implements Queue
// Ignore error if the group already exists
}
try
{
// Read a single message starting from the oldest (>)
$messages = $this->redis->xReadGroup($this->group, $this->consumer, [$stream => '>'], 1);
if (!count($messages))
@ -102,6 +105,11 @@ class RedisQueue implements Queue
return $message['message'];
}
}
}
catch (Exception $e)
{
throw new \Exception('Redis server failed to answer !');
}
return null;
}