mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-10-22 01:40: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
|
// Ignore error if the group already exists
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// Read a single message starting from the oldest (>)
|
// Read a single message starting from the oldest (>)
|
||||||
$messages = $this->redis->xReadGroup($this->group, $this->consumer, [$stream => '>'], 1);
|
$messages = $this->redis->xReadGroup($this->group, $this->consumer, [$stream => '>'], 1);
|
||||||
if (!count($messages))
|
if (!count($messages))
|
||||||
|
@ -102,6 +105,11 @@ class RedisQueue implements Queue
|
||||||
return $message['message'];
|
return $message['message'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
throw new \Exception('Redis server failed to answer !');
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue