mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-25 01:35:14 +00:00
Merge pull request #268 from nazo/master
return false if `json_encode()` failed.
This commit is contained in:
commit
be9ef1b92b
@ -101,8 +101,12 @@ class Resque
|
|||||||
*/
|
*/
|
||||||
public static function push($queue, $item)
|
public static function push($queue, $item)
|
||||||
{
|
{
|
||||||
|
$encodedItem = json_encode($item);
|
||||||
|
if ($encodedItem === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
self::redis()->sadd('queues', $queue);
|
self::redis()->sadd('queues', $queue);
|
||||||
$length = self::redis()->rpush('queue:' . $queue, json_encode($item));
|
$length = self::redis()->rpush('queue:' . $queue, $encodedItem);
|
||||||
if ($length < 1) {
|
if ($length < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user