...
|
...
|
@@ -185,7 +185,7 @@ function create_coroutine(array &$cid,int &$isRunMaxCNum,$worker_id){ |
|
|
|
|
|
// 开始同步
|
|
|
try {
|
|
|
sync();
|
|
|
sync($worker_id);
|
|
|
}catch (\Throwable $e){
|
|
|
_echo($e->getMessage());
|
|
|
logs(
|
...
|
...
|
@@ -210,12 +210,16 @@ function create_coroutine(array &$cid,int &$isRunMaxCNum,$worker_id){ |
|
|
|
|
|
/**
|
|
|
* 开始同步, 这里是主要的业务代码
|
|
|
* @param int $worker_id 进程号
|
|
|
* @return int
|
|
|
* @author:dc
|
|
|
* @time 2023/2/13 9:42
|
|
|
* @time 2023/2/18 11:27
|
|
|
*/
|
|
|
function sync(){
|
|
|
function sync($worker_id=0){
|
|
|
// 需要同步的id
|
|
|
$id = redis()->lPop('sync_email_lists');
|
|
|
_echo($worker_id.': 协程('.co::getCid().'):抢到 '.$id);
|
|
|
|
|
|
if(!$id){
|
|
|
co::sleep(1);
|
|
|
return -1;
|
...
|
...
|
|