作者 邓超

调优

@@ -41,41 +41,26 @@ class AutoMail { @@ -41,41 +41,26 @@ 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"=>[
68 - "bool"=>[  
69 - "must"=>[  
70 - ["term"=>["folder_as_int" => 1]], // 收件箱  
71 - ["term"=>["is_auto" => 0]], // 非auto  
72 - ["term"=>["is_hots" => 0]], // 非预热  
73 - ["term"=>["deleted" => 0]], // 非删除  
74 - // 自动关键字  
75 - [  
76 - "bool" => [  
77 - "should"=> $not_must,  
78 - "minimum_should_match" => 1 49 + "constant_score"=>[
  50 + "filter"=>[
  51 + "bool"=>[
  52 + "must"=>[
  53 + ["term"=>["folder_as_int" => 1]], // 收件箱
  54 + ["term"=>["is_auto" => 0]], // 非auto
  55 + ["term"=>["is_hots" => 0]], // 非预热
  56 + ["term"=>["deleted" => 0]], // 非删除
  57 + // 自动关键字
  58 + [
  59 + "bool" => [
  60 + "should"=> $not_must,
  61 + "minimum_should_match" => 1
  62 + ]
  63 + ]
79 ] 64 ]
80 ] 65 ]
81 ] 66 ]
@@ -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 }