protected static function initId()
{
// 遍历创建的所有Worker.
foreach (self::$_workers as $worker_id => $worker) {
$new_id_map = array();
// 根据每个worker的运行数量,初始化每个worker对应的id
for($key = 0; $key < $worker->count; $key++) {
$new_id_map[$key] = isset(self::$_idMap[$worker_id][$key]) ? self::$_idMap[$worker_id][$key] : 0;
}
self::$_idMap[$worker_id] = $new_id_map;
}
}
1. 初始化每个worker运行进程的id.
Worker::initId()解析
最新推荐文章于 2023-01-06 15:02:07 发布