作者 邓超

优化

... ... @@ -92,6 +92,7 @@ class SyncToEsCmd {
while (!$this->isStop()){
$id = redis()->lPop('sync_to_es');
$origin_id = $id;
$code = 500;
if($id){
... ... @@ -109,7 +110,7 @@ class SyncToEsCmd {
$data = $this->db->throw()->first(\Model\listsSql::firstHot('`id` = '.$id));
}
}catch (Throwable $e){
redis()->rPush('sync_to_es',$id);
redis()->rPush('sync_to_es',$origin_id);
_echo('sync to es '.$e->getMessage());
break;
}
... ... @@ -143,7 +144,7 @@ class SyncToEsCmd {
list($data['postid'],$data['source']) = $this->getPostid($data['email_id'],$data['udate']);
}catch (Throwable $e){
redis()->rPush('sync_to_es',$id);
redis()->rPush('sync_to_es',$origin_id);
_echo('sync to es '.$e->getMessage());
break;
}
... ...
... ... @@ -653,6 +653,10 @@ class SyncMail {
Fun::mb_convert_encoding(mb_substr($parseBody->getText(),0,150),'utf-8')
],dbWhere(['id'=> $id]));
\co::sleep(1);
// 同步es
redis()->rPush('sync_to_es', $id.'.1');
}
... ...