作者 邓超

调优

@@ -41,30 +41,13 @@ class AutoMail { @@ -41,30 +41,13 @@ class AutoMail {
41 $not_must[] = ["match_phrase"=>["from.email"=>$str]]; 41 $not_must[] = ["match_phrase"=>["from.email"=>$str]];
42 } 42 }
43 } 43 }
44 -echo json_encode([  
45 - "_source" => ["uuid"],  
46 - "query"=>[  
47 - "bool"=>[  
48 - "must"=>[  
49 - ["term"=>["folder_as_int" => 1]], // 收件箱  
50 - ["term"=>["is_auto" => 0]], // 非auto  
51 - ["term"=>["is_hots" => 0]], // 非预热  
52 - ["term"=>["deleted" => 0]], // 非删除  
53 - // 自动关键字  
54 - [  
55 - "bool" => [  
56 - "should"=> $not_must,  
57 - "minimum_should_match" => 1  
58 - ]  
59 - ]  
60 - ]  
61 - ]  
62 - ]  
63 - ]);exit; 44 +
64 // 查询自动回的邮件 45 // 查询自动回的邮件
65 $lists = $es->search([ 46 $lists = $es->search([
66 "_source" => ["uuid"], 47 "_source" => ["uuid"],
67 "query"=>[ 48 "query"=>[
  49 + "constant_score"=>[
  50 + "filter"=>[
68 "bool"=>[ 51 "bool"=>[
69 "must"=>[ 52 "must"=>[
70 ["term"=>["folder_as_int" => 1]], // 收件箱 53 ["term"=>["folder_as_int" => 1]], // 收件箱
@@ -81,6 +64,8 @@ echo json_encode([ @@ -81,6 +64,8 @@ echo json_encode([
81 ] 64 ]
82 ] 65 ]
83 ] 66 ]
  67 + ]
  68 + ]
84 ],0,1000,[],1000); 69 ],0,1000,[],1000);
85 70
86 foreach ($lists['hits']['hits']??[] as $list){ 71 foreach ($lists['hits']['hits']??[] as $list){
@@ -71,7 +71,7 @@ class SyncToEsCmd { @@ -71,7 +71,7 @@ class SyncToEsCmd {
71 break; 71 break;
72 } 72 }
73 73
74 - $id = redis()->lPop('sync_to_es'.S_V2); 74 + $id = redis()->rPop('sync_to_es'.S_V2);
75 $code = 500; 75 $code = 500;
76 if($id){ 76 if($id){
77 $doc_id = ''; 77 $doc_id = '';
@@ -81,7 +81,7 @@ class SyncToEsCmd { @@ -81,7 +81,7 @@ class SyncToEsCmd {
81 $data = $db->throw()->first('select * from `lists` where `id` = '.$id); 81 $data = $db->throw()->first('select * from `lists` where `id` = '.$id);
82 } 82 }
83 }catch (Throwable $e){ 83 }catch (Throwable $e){
84 - redis()->rPush('sync_to_es'.S_V2,$id); 84 + redis()->lPush('sync_to_es'.S_V2,$id);
85 _echo('sync to es '.$e->getMessage()); 85 _echo('sync to es '.$e->getMessage());
86 break; 86 break;
87 } 87 }
@@ -125,7 +125,7 @@ class SyncToEsCmd { @@ -125,7 +125,7 @@ class SyncToEsCmd {
125 // postid ai邮箱要用 这个是查询黑格 125 // postid ai邮箱要用 这个是查询黑格
126 list($data['postid'],$data['source']) = $this->getPostid($data['email_id']); 126 list($data['postid'],$data['source']) = $this->getPostid($data['email_id']);
127 }catch (Throwable $e){ 127 }catch (Throwable $e){
128 - redis()->rPush('sync_to_es'.S_V2,$id); 128 + redis()->lPush('sync_to_es'.S_V2,$id);
129 _echo('sync to es '.$e->getMessage()); 129 _echo('sync to es '.$e->getMessage());
130 break; 130 break;
131 } 131 }