|
@@ -8,6 +8,7 @@ require_once(BASE_ROOT_PATH . '/helper/performance_helper.php');
|
|
|
use Redis;
|
|
|
use Exception;
|
|
|
use Log;
|
|
|
+use Swoole;
|
|
|
|
|
|
class IQueueDB
|
|
|
{
|
|
@@ -26,7 +27,7 @@ class IQueueDB
|
|
|
$this->_comode = $comode;
|
|
|
|
|
|
if ($this->_comode) {
|
|
|
- $this->_redis = new \Swoole\Coroutine\Redis();
|
|
|
+ $this->_redis = new Swoole\Coroutine\Redis();
|
|
|
$ret = $this->_redis->connect(C('coroutine.redis_host'), C('coroutine.redis_port'));
|
|
|
} else {
|
|
|
$this->_redis = new Redis();
|
|
@@ -221,7 +222,7 @@ abstract class ILooper
|
|
|
perfor_clear();
|
|
|
if(defined('USE_COROUTINE') && USE_COROUTINE)
|
|
|
{
|
|
|
- $res = \Swoole\Coroutine::stats();
|
|
|
+ $res = Swoole\Coroutine::stats();
|
|
|
$num = $res['coroutine_num'];
|
|
|
$mem = memory_get_usage();
|
|
|
Log::record("IQueueDB::run coroutin_num={$num} memory={$mem}",Log::DEBUG);
|
|
@@ -229,7 +230,7 @@ abstract class ILooper
|
|
|
if($num < ILooper::MAX_COROUTINE)
|
|
|
{
|
|
|
if($this->mServer->connect() == false) {
|
|
|
- \Swoole\Coroutine::sleep(1);
|
|
|
+ Swoole\Coroutine::sleep(1);
|
|
|
Log::record("Processor redis disconnect.",Log::ERR);
|
|
|
continue;
|
|
|
}
|
|
@@ -268,7 +269,7 @@ abstract class ILooper
|
|
|
// }
|
|
|
}
|
|
|
else {
|
|
|
- \Swoole\Coroutine::sleep(0.1);
|
|
|
+ Swoole\Coroutine::sleep(0.1);
|
|
|
}
|
|
|
}
|
|
|
else
|