作者 邓超

es

@@ -193,7 +193,7 @@ class SyncToEsCmd { @@ -193,7 +193,7 @@ class SyncToEsCmd {
193 public function setEsMap($index){ 193 public function setEsMap($index){
194 $this->es->setIndex($index); 194 $this->es->setIndex($index);
195 if($this->es->getMapping()){ 195 if($this->es->getMapping()){
196 - return true; 196 + return 9;
197 } 197 }
198 198
199 if(redis()->add('setmaplock:'.$index,1,20)){ 199 if(redis()->add('setmaplock:'.$index,1,20)){
@@ -265,12 +265,15 @@ class SyncToEsCmd { @@ -265,12 +265,15 @@ class SyncToEsCmd {
265 $this->es->setIndex($index); 265 $this->es->setIndex($index);
266 // 检查数据库是否存在 266 // 检查数据库是否存在
267 if(empty($this->checkEsIndex[$index]) && $index != 'email_lists_copy'){ 267 if(empty($this->checkEsIndex[$index]) && $index != 'email_lists_copy'){
  268 + if(!redis()->has('esmapcheck:'.$index)){
268 $m = $this->setEsMap($index); 269 $m = $this->setEsMap($index);
269 - _echo("{$index} 创建索引 ".$m); 270 + if($m !== 9) _echo("{$index} 创建索引 ".$m);
270 if(!$m){ 271 if(!$m){
271 $this->log($data_id,$index); 272 $this->log($data_id,$index);
272 return; 273 return;
273 } 274 }
  275 + redis()->set('esmapcheck:'.$index,1,86400);
  276 + }
274 } 277 }
275 // 下次不在检查 278 // 下次不在检查
276 $this->checkEsIndex[$index] = 1; 279 $this->checkEsIndex[$index] = 1;