作者 邓超

优化

@@ -92,6 +92,7 @@ class SyncToEsCmd { @@ -92,6 +92,7 @@ class SyncToEsCmd {
92 while (!$this->isStop()){ 92 while (!$this->isStop()){
93 93
94 $id = redis()->lPop('sync_to_es'); 94 $id = redis()->lPop('sync_to_es');
  95 + $origin_id = $id;
95 $code = 500; 96 $code = 500;
96 if($id){ 97 if($id){
97 98
@@ -109,7 +110,7 @@ class SyncToEsCmd { @@ -109,7 +110,7 @@ class SyncToEsCmd {
109 $data = $this->db->throw()->first(\Model\listsSql::firstHot('`id` = '.$id)); 110 $data = $this->db->throw()->first(\Model\listsSql::firstHot('`id` = '.$id));
110 } 111 }
111 }catch (Throwable $e){ 112 }catch (Throwable $e){
112 - redis()->rPush('sync_to_es',$id); 113 + redis()->rPush('sync_to_es',$origin_id);
113 _echo('sync to es '.$e->getMessage()); 114 _echo('sync to es '.$e->getMessage());
114 break; 115 break;
115 } 116 }
@@ -143,7 +144,7 @@ class SyncToEsCmd { @@ -143,7 +144,7 @@ class SyncToEsCmd {
143 list($data['postid'],$data['source']) = $this->getPostid($data['email_id'],$data['udate']); 144 list($data['postid'],$data['source']) = $this->getPostid($data['email_id'],$data['udate']);
144 145
145 }catch (Throwable $e){ 146 }catch (Throwable $e){
146 - redis()->rPush('sync_to_es',$id); 147 + redis()->rPush('sync_to_es',$origin_id);
147 _echo('sync to es '.$e->getMessage()); 148 _echo('sync to es '.$e->getMessage());
148 break; 149 break;
149 } 150 }
@@ -653,6 +653,10 @@ class SyncMail { @@ -653,6 +653,10 @@ class SyncMail {
653 Fun::mb_convert_encoding(mb_substr($parseBody->getText(),0,150),'utf-8') 653 Fun::mb_convert_encoding(mb_substr($parseBody->getText(),0,150),'utf-8')
654 ],dbWhere(['id'=> $id])); 654 ],dbWhere(['id'=> $id]));
655 655
  656 + \co::sleep(1);
  657 + // 同步es
  658 + redis()->rPush('sync_to_es', $id.'.1');
  659 +
656 } 660 }
657 661
658 662