fix: 修复日志输出与代码格式错误
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-03-25 01:22:44 +08:00
committed by cnb
parent e0a82d57b4
commit f8b8a87331
13 changed files with 146 additions and 54 deletions

View File

@@ -39,7 +39,7 @@ var DefaultGenerator = utils.NewGen(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
func init() {
// 创建 IdGeneratorOptions 对象,可在构造函数中输入 WorkerId
Logger.SetFlags(glog.F_TIME_STD | glog.F_FILE_LONG | glog.F_ASYNC) //设置flag
Logger.Print(ctx, "初始化日志")
// for i := 0; i < 600; i++ {
// glog.Debug(context.Background(), i, "初始化雪花算法", DefaultGenerator.Get())
// }

View File

@@ -42,7 +42,6 @@ func ListenFunc(ctx g.Ctx) {
time.Sleep(retryDelay)
continue
}
cool.Logger.Info(ctx, "成功获取 Redis 连接")
// 2. 启动心跳保活协程,防止连接因空闲被断开
heartbeatCtx, heartbeatCancel := context.WithCancel(context.Background())
@@ -67,7 +66,7 @@ func ListenFunc(ctx g.Ctx) {
_ = conn.Close(ctx)
return
}
cool.Logger.Debug(ctx, "Redis 心跳发送成功,连接正常")
}
}
}()
@@ -170,7 +169,6 @@ func ListenFight(ctx g.Ctx) {
time.Sleep(retryDelay)
continue
}
cool.Logger.Info(ctx, "成功获取 Redis 连接")
// 2. 启动心跳保活协程(完全对齐 ListenFunc 逻辑)
heartbeatCtx, heartbeatCancel := context.WithCancel(context.Background())