mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-10-21 17:30:02 +02:00
Improve redis queue handling of error
This commit is contained in:
parent
08cbb0f12e
commit
9e2bd47e34
1 changed files with 19 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue