更新MongoDB配置并优化Redis客户端调用方式

This commit is contained in:
2026-02-27 08:59:59 +08:00
parent 4a9aab8abb
commit b2c50502ce
4 changed files with 16 additions and 18 deletions

24
main.go
View File

@@ -6,15 +6,11 @@ import (
"oss/service"
"time"
"gitea.com/red-future/common/db/mongo"
"gitea.com/red-future/common/log/consts"
"gitea.com/red-future/common/message"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/os/gtimer"
"gitea.com/red-future/common/http"
"gitea.com/red-future/common/jaeger"
logService "gitea.com/red-future/common/log/service"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
)
@@ -35,16 +31,16 @@ func main() {
})
// 启动消息队列消费者
if err := message.StartConsumers(ctx, &message.RedisMessageConfig{
StreamKey: mongo.LogRedisKey,
GroupName: consts.GroupName,
ConsumerName: consts.ConsumerName,
BatchSize: consts.BatchSize,
AutoAck: consts.AutoAck,
HandleFunc: logService.OperationLog.AddOperationLog,
}); err != nil {
return
}
//if err := message.StartConsumers(ctx, &message.RedisMessageConfig{
// StreamKey: mongo.LogRedisKey,
// GroupName: consts.GroupName,
// ConsumerName: consts.ConsumerName,
// BatchSize: consts.BatchSize,
// AutoAck: consts.AutoAck,
// HandleFunc: logService.OperationLog.AddOperationLog,
//}); err != nil {
// return
//}
// 保持应用运行
select {}