asyncRedis error
wangjinbei opened this issue · comments
修改redis.php的配置信息如下:
return [
'redis'=>[
'ip' => 'localhost',
'port' => 6379,
'select' => 0,
'password' => '123456',
'asyn_max_count' => 10,
]
];
修改index.php的demo如下:
yield Db::redis()->cache('abcd', 123);
$data = yield Db::redis()->cache('abcd');
return $data;
运行结果报错:
2016-09-29 12:51:17.82167000 ERROR-error:Uncaught Exception: 操作失败 in /Users/william/strong/zhttp/ZPHP/Coroutine/Redis/RedisAsynPool.php:79
Stack trace:
#0 [internal function]: ZPHP\Coroutine\Redis\RedisAsynPool->ZPHP\Coroutine\Redis{closure}(Object(Swoole\Redis), false)
#1 /Users/william/strong/zhttp/ZPHP/Socket/Adapter/Swoole.php(139): Swoole\Http\Server->start()
#2 /Users/william/strong/zhttp/ZPHP/Server/Adapter/Socket.php(37): ZPHP\Socket\Adapter\Swoole->run()
#3 /Users/william/strong/zhttp/ZPHP/ZPHP.php(265): ZPHP\Server\Adapter\Socket->run()
#4 /Users/william/strong/zhttp/ZPHP/ZPHP.php(243): ZPHP\ZPHP::start(true)
#5 /Users/william/strong/zhttp/ZPHP/ZPHP.php(226): ZPHP\ZPHP::doCommand('restart', true)
#6 /Users/william/strong/zhttp/webroot/main.php(8): ZPHP\ZPHP::run('/Users/william/...')
#7 {main}
thrown (/Users/william/strong/zhttp/ZPHP/Coroutine/Redis/RedisAsynPool.php:79)
另外:
connection.php中的配置文件,未清理:
return array(
//tcp 用于管理连接用的
'connection'=>array(
'adapter' => 'Redis',
'pconnect' => true,
'host' => '192.168.5.252',
'port' => 6379,
'timeout' => 5,
'prefix' => 'zchat'
)
);
redis bug已经修复
后续会增加一个异常处理机制
等下测试下async redis ;
这里说的“异常处理机制” 是指???
在异步调用中直接抛异常,能像同步形式的开发那样冒泡?
我说的是框架底层执行的时候执行mysql或者redis触发的异常。平时业务开发的话只要异常就会直接抛给父类controller的onExceptionHandle函数了
可以加我QQ:286252682,有时候可能github没那么及时看到
ok!