mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 13:42:22 +00:00
Merge pull request #268 from nazo/master
return false if `json_encode()` failed.
This commit is contained in:
commit
be9ef1b92b
1 changed files with 5 additions and 1 deletions
|
@ -101,8 +101,12 @@ class Resque
|
|||
*/
|
||||
public static function push($queue, $item)
|
||||
{
|
||||
$encodedItem = json_encode($item);
|
||||
if ($encodedItem === false) {
|
||||
return false;
|
||||
}
|
||||
self::redis()->sadd('queues', $queue);
|
||||
$length = self::redis()->rpush('queue:' . $queue, json_encode($item));
|
||||
$length = self::redis()->rpush('queue:' . $queue, $encodedItem);
|
||||
if ($length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue