resque php redis,redis - php-resque遇到坑

Resque::enqueue存数据放到redis队列,worker拿出来json_decode有时是不完整的(访问量大的时候出现几率可能更高,没完全验证)!

郁闷极至。通读了多编php-ressue代码,也很清晰,看不出啥问题啊。 php-ressue中打log如下(Rescue.php),

public static function pop($queue)

{

$item = self::redis()->lpop('queue:' . $queue);

if(!$item) {

return;

}

$result = json_decode($item, true);

if(!is_array($result)) error_log('why not array : ' . $item);

return $result;

}

php日志中一天会出现过几次why not array ..,输出的$item不是有效的json

哪位兄弟有经验的,给点思路?给点建议?

回复内容:

Resque::enqueue存数据放到redis队列,worker拿出来json_decode有时是不完整的(访问量大的时候出现几率可能更高,没完全验证)!

郁闷极至。通读了多编php-ressue代码,也很清晰,看不出啥问题啊。 php-ressue中打log如下(Rescue.php),

public static function pop($queue)

{

$item = self::redis()->lpop('queue:' . $queue);

if(!$item) {

return;

}

$result = json_decode($item, true);

if(!is_array($result)) error_log('why not array : ' . $item);

return $result;

}

php日志中一天会出现过几次why not array ..,输出的$item不是有效的json

哪位兄弟有经验的,给点思路?给点建议?

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值