This commit is contained in:
@@ -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())
|
||||
// }
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user