作者 邓超

x

@@ -5,13 +5,15 @@ include_once __DIR__."/../vendor/autoload.php"; @@ -5,13 +5,15 @@ include_once __DIR__."/../vendor/autoload.php";
5 5
6 6
7 swoole_set_process_name('php-email-sync-list'); 7 swoole_set_process_name('php-email-sync-list');
8 - 8 +//TODO:: 不知道为什么,隔断时间mysql会连不上
9 \Co\run(function (){ 9 \Co\run(function (){
10 - 10 + $start_time = time();
11 $goNum = 0; 11 $goNum = 0;
12 // 循环阻塞 12 // 循环阻塞
13 while (true){ 13 while (true){
14 14
  15 + if (time() - $start_time > 24000){ break; }
  16 +
15 if($goNum > 50){ 17 if($goNum > 50){
16 co::sleep(0.5); 18 co::sleep(0.5);
17 continue; 19 continue;
@@ -86,6 +88,10 @@ swoole_set_process_name('php-email-sync-list'); @@ -86,6 +88,10 @@ swoole_set_process_name('php-email-sync-list');
86 88
87 } 89 }
88 90
  91 + while ($goNum > 0){
  92 + co::sleep(1);
  93 + }
  94 +
89 95
90 }); 96 });
91 97