作者 邓超

同步到es 改成批量

... ... @@ -107,6 +107,9 @@ class SyncToEsCmd {
$nowSubmit = false;
$id = redis()->lPop('sync_to_es');
if($id){
//
file_put_contents(LOG_PATH.'/sync_es_ids.log',$id."\n",FILE_APPEND|LOCK_EX);
$ids[] = $id;
$this->bulkData($id);
}else{
... ... @@ -337,6 +340,10 @@ class SyncToEsCmd {
}
}
}
// 为空不提交
if($this->bulkData->isEmpty()){
return true;
}
// 上一次提交的时间
$this->pervSubmitTime = time();
... ...