perf: 根据golangci检测结果,优化部分代码

This commit is contained in:
mh-swift
2024-07-09 17:32:52 +08:00
parent 5c3bcaf6cc
commit 9133afb864
6 changed files with 32 additions and 27 deletions

View File

@@ -7,6 +7,12 @@ package queue
import (
"context"
"hotgo/internal/consts"
"hotgo/utility/simple"
"hotgo/utility/validate"
"sync"
"time"
"github.com/apache/rocketmq-client-go/v2"
"github.com/apache/rocketmq-client-go/v2/admin"
"github.com/apache/rocketmq-client-go/v2/consumer"
@@ -16,11 +22,6 @@ import (
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/grpool"
"hotgo/internal/consts"
"hotgo/utility/simple"
"hotgo/utility/validate"
"sync"
"time"
)
type RocketMq struct {
@@ -191,7 +192,7 @@ func (r *RocketMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg))
err = r.consumerIns.Subscribe(topic, consumer.MessageSelector{}, func(ctx context.Context, msgs ...*primitive.MessageExt) (consumer.ConsumeResult, error) {
for _, item := range msgs {
rocketManager.goPool.Add(ctx, func(ctx context.Context) {
_ = rocketManager.goPool.Add(ctx, func(ctx context.Context) {
receiveDo(MqMsg{
RunType: ReceiveMsg,
Topic: item.Topic,