作者 邓超

优化同步

@@ -251,6 +251,7 @@ class SyncMail { @@ -251,6 +251,7 @@ class SyncMail {
251 /********************* 同步邮件 **********************/ 251 /********************* 同步邮件 **********************/
252 $syncNum = []; 252 $syncNum = [];
253 // 循环文件夹 253 // 循环文件夹
  254 + $startTime = time();
254 foreach ($folders->all() as $f){ 255 foreach ($folders->all() as $f){
255 if($this->isStop) return; 256 if($this->isStop) return;
256 257
@@ -262,13 +263,13 @@ class SyncMail { @@ -262,13 +263,13 @@ class SyncMail {
262 $num = $this->mail($folder); 263 $num = $this->mail($folder);
263 if($num){ 264 if($num){
264 $syncNum[$folder->getName()] = $num; 265 $syncNum[$folder->getName()] = $num;
265 - _echo($this->emailId().' ===> '.$folder->getName().' ===> '.$num); 266 +// _echo($this->emailId().' ===> '.$folder->getName().' ===> '.$num);
266 } 267 }
267 } 268 }
268 269
269 } 270 }
270 } 271 }
271 - 272 + _echo($this->emailId()."=>runTime:".(time()-$startTime).'s => total: '.(array_sum($syncNum)));
272 return $syncNum; 273 return $syncNum;
273 } 274 }
274 275