为什么subscribe过不去呢??

idcfykj

$worker = new Worker();
$worker->count = 100;
$worker->onWorkerStart = function ($worker) {
$client = Test::getServer();
// 订阅
$id = $worker->id;
$client->subscribe("task-{$id}", function($data)use($id) {
var_dump(66666);
try {
$person = new ProcessPerson();
$person->step1($data);
} catch (\Exception $e) {
var_dump($e->getMessage());
}
});
};

Worker::runAll();

截图

到这里就不往下走了晕死了

2084 2 0
2个回答

walkor

redis 扩展的subscribe是阻塞操作,后面的代码不会执行,除非subscribe返回。
如果你要非阻塞subscribe,可以用 workerman/redis,参见手册 http://doc.workerman.net/components/workerman-redis.html

idcfykj

我调试跟踪到这里就不行了。截图

  • 暂无评论
年代过于久远,无法发表回答
🔝