Loading src/Handler/LogTrace/LogTraceHandler.php +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ class LogTraceHandler }else if (is_string($track)||is_numeric($track)) { $logInfo = $track; }else{ $logInfo = print_r($track, true); $logInfo = json_encode($track,JSON_PRETTY_PRINT); ;//print_r($track, true); } $logInfo .= "\n\n"; Loading src/Handler/RedisQueueBatchHandler.php +4 −4 Original line number Diff line number Diff line Loading @@ -72,8 +72,6 @@ abstract class RedisQueueBatchHandler //每次从列表取100 $arr = $this->redis->lRange($this->queue_name,0,self::BATCH_DEAL_NUM-1); //取完 从队列删掉 $this->redis->lTrim($this->queue_name,count($arr),-1); //数据格式化 $formatArr = array_map(function ($item){ return json_decode($item,true); Loading @@ -81,15 +79,17 @@ abstract class RedisQueueBatchHandler try { //具体批处理逻辑 $this->batchDeal($formatArr); //取完 从队列删掉 $this->redis->lTrim($this->queue_name,count($arr),-1); }catch (\Throwable $exception){ //错误码为100 重新推到队列 if($exception->getCode()==self::ERROR_RETRY_CODE){ if($this->retry<self::MAX_RETRY_TIMES){ //重试次数不超过3次 $this->backToQueue($arr); //$this->backToQueue($arr); $this->retry++; }else{ $this->redis->lTrim($this->queue_name,count($arr),-1); $this->retry = 0; //重置当前次数 $this->errorWriteToFile($formatArr,$exception); } Loading Loading
src/Handler/LogTrace/LogTraceHandler.php +1 −1 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ class LogTraceHandler }else if (is_string($track)||is_numeric($track)) { $logInfo = $track; }else{ $logInfo = print_r($track, true); $logInfo = json_encode($track,JSON_PRETTY_PRINT); ;//print_r($track, true); } $logInfo .= "\n\n"; Loading
src/Handler/RedisQueueBatchHandler.php +4 −4 Original line number Diff line number Diff line Loading @@ -72,8 +72,6 @@ abstract class RedisQueueBatchHandler //每次从列表取100 $arr = $this->redis->lRange($this->queue_name,0,self::BATCH_DEAL_NUM-1); //取完 从队列删掉 $this->redis->lTrim($this->queue_name,count($arr),-1); //数据格式化 $formatArr = array_map(function ($item){ return json_decode($item,true); Loading @@ -81,15 +79,17 @@ abstract class RedisQueueBatchHandler try { //具体批处理逻辑 $this->batchDeal($formatArr); //取完 从队列删掉 $this->redis->lTrim($this->queue_name,count($arr),-1); }catch (\Throwable $exception){ //错误码为100 重新推到队列 if($exception->getCode()==self::ERROR_RETRY_CODE){ if($this->retry<self::MAX_RETRY_TIMES){ //重试次数不超过3次 $this->backToQueue($arr); //$this->backToQueue($arr); $this->retry++; }else{ $this->redis->lTrim($this->queue_name,count($arr),-1); $this->retry = 0; //重置当前次数 $this->errorWriteToFile($formatArr,$exception); } Loading