return false if json_encode() failed.

This commit is contained in:
Takuya Sato 2015-08-26 10:26:48 +09:00
parent df69e8980c
commit 9c20e44483

View File

@ -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;
}