Loading src/Handler/LogTrace/LogTraceQueue.php +2 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ namespace Meibuyu\Micro\Handler\LogTrace; use Meibuyu\Micro\Handler\RedisQueueBatchHandler; use Meibuyu\Micro\Model\LogTrace; use Hyperf\DbConnection\Db; use Hyperf\Redis\Redis; class LogTraceQueue extends RedisQueueBatchHandler { Loading @@ -16,7 +17,7 @@ class LogTraceQueue extends RedisQueueBatchHandler return env('APP_NAME').':LogTraceQueue'; } protected function specifyRedisServer() protected function specifyRedisServer():Redis { $redis = redis(); $redis->select(0); Loading src/Handler/RedisQueueBatchHandler.php +8 −8 Original line number Diff line number Diff line Loading @@ -2,19 +2,19 @@ namespace Meibuyu\Micro\Handler; use Hyperf\Redis\Redis; abstract class RedisQueueBatchHandler { /** * 重试次数 */ protected $retrys=0; protected $retry=0; protected $queue_name; /** * @var \Hyperf\Redis\Redis * @var Redis */ protected $redis; Loading Loading @@ -56,7 +56,7 @@ abstract class RedisQueueBatchHandler //批处理具体逻辑 abstract protected function batchDeal($data); abstract protected function specifyQueueName(); abstract protected function specifyRedisServer(); abstract protected function specifyRedisServer() : Redis; public function consume() Loading Loading @@ -86,16 +86,16 @@ abstract class RedisQueueBatchHandler //错误码为100 重新推到队列 if($exception->getCode()==self::ERROR_RETRY_CODE){ if($this->retrys<self::MAX_RETRY_TIMES){ //重试次数不超过3次 if($this->retry<self::MAX_RETRY_TIMES){ //重试次数不超过3次 $this->backToQueue($arr); $this->retrys++; $this->retry++; }else{ $this->retrys = 0; //重置当前次数 $this->retry = 0; //重置当前次数 $this->errorWriteToFile($formatArr,$exception); } }else{ $this->retrys = 0; $this->retry = 0; $this->errorWriteToFile($formatArr,$exception); } Loading Loading
src/Handler/LogTrace/LogTraceQueue.php +2 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ namespace Meibuyu\Micro\Handler\LogTrace; use Meibuyu\Micro\Handler\RedisQueueBatchHandler; use Meibuyu\Micro\Model\LogTrace; use Hyperf\DbConnection\Db; use Hyperf\Redis\Redis; class LogTraceQueue extends RedisQueueBatchHandler { Loading @@ -16,7 +17,7 @@ class LogTraceQueue extends RedisQueueBatchHandler return env('APP_NAME').':LogTraceQueue'; } protected function specifyRedisServer() protected function specifyRedisServer():Redis { $redis = redis(); $redis->select(0); Loading
src/Handler/RedisQueueBatchHandler.php +8 −8 Original line number Diff line number Diff line Loading @@ -2,19 +2,19 @@ namespace Meibuyu\Micro\Handler; use Hyperf\Redis\Redis; abstract class RedisQueueBatchHandler { /** * 重试次数 */ protected $retrys=0; protected $retry=0; protected $queue_name; /** * @var \Hyperf\Redis\Redis * @var Redis */ protected $redis; Loading Loading @@ -56,7 +56,7 @@ abstract class RedisQueueBatchHandler //批处理具体逻辑 abstract protected function batchDeal($data); abstract protected function specifyQueueName(); abstract protected function specifyRedisServer(); abstract protected function specifyRedisServer() : Redis; public function consume() Loading Loading @@ -86,16 +86,16 @@ abstract class RedisQueueBatchHandler //错误码为100 重新推到队列 if($exception->getCode()==self::ERROR_RETRY_CODE){ if($this->retrys<self::MAX_RETRY_TIMES){ //重试次数不超过3次 if($this->retry<self::MAX_RETRY_TIMES){ //重试次数不超过3次 $this->backToQueue($arr); $this->retrys++; $this->retry++; }else{ $this->retrys = 0; //重置当前次数 $this->retry = 0; //重置当前次数 $this->errorWriteToFile($formatArr,$exception); } }else{ $this->retrys = 0; $this->retry = 0; $this->errorWriteToFile($formatArr,$exception); } Loading