...
|
...
|
@@ -20,10 +20,17 @@ function start(){ |
|
|
// 启动业务进程
|
|
|
$pm->addBatch(WORKER_NUM,function (Process\Pool $pool, int $worker_id){
|
|
|
_echo("业务进程({$worker_id})启动成功");
|
|
|
swoole_set_process_name('php-email-sync-list-'.$worker_id);
|
|
|
|
|
|
$run_timer = time();
|
|
|
// 循环阻塞
|
|
|
while (true){
|
|
|
swoole_set_process_name('php-email-sync-list-'.$worker_id);
|
|
|
|
|
|
// 运行超过1天的 停止
|
|
|
if($run_timer < (time()-86400)){
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
// 需要同步的id
|
|
|
$id = redis()->lPop('sync_email_lists');
|
|
|
|
...
|
...
|
@@ -65,8 +72,13 @@ function start(){ |
|
|
$pm->add(function (Process\Pool $pool, int $worker_id){
|
|
|
_echo("业务进程({$worker_id})启动成功,body");
|
|
|
swoole_set_process_name('php-email-sync-body-'.$worker_id);
|
|
|
$run_timer = time();
|
|
|
// 循环阻塞
|
|
|
while (true){
|
|
|
// 运行超过1天的 停止
|
|
|
if($run_timer < (time()-86400)){
|
|
|
break;
|
|
|
}
|
|
|
// 需要同步的id
|
|
|
$id = redis()->lPop('sync_email_body');
|
|
|
|
...
|
...
|
|