From 4fd262beae564dece2711f9cd8754d013135a224 Mon Sep 17 00:00:00 2001 From: ayflying Date: Tue, 2 Dec 2025 12:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0=E4=B8=8E?= =?UTF-8?q?=E5=86=99=E5=85=A5=E7=9A=84=E6=8C=81=E8=AE=A1=E5=88=92=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/gameAct/gameAct.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/logic/gameAct/gameAct.go b/internal/logic/gameAct/gameAct.go index 20706a7..581b62f 100644 --- a/internal/logic/gameAct/gameAct.go +++ b/internal/logic/gameAct/gameAct.go @@ -237,7 +237,7 @@ func (s *sGameAct) Save(ctx context.Context, actId int) (err error) { } //删除缓存 - //s.DelCacheKey(ctx, v.ActId, v.Uid) + s.DelCacheKey(ctx, v.ActId, v.Uid) updateCount++ update = make([]*entity.GameAct, 0) @@ -458,10 +458,10 @@ func (s *sGameAct) Cache2Sql(ctx context.Context, add, update []*entity.GameAct) tx, err = g.DB().Begin(ctx) } //删除缓存 - //s.DelCacheKey(ctx, v.ActId, v.Uid) + s.DelCacheKey(ctx, v.ActId, v.Uid) } //循环结束了,最后写入一波 - g.Log().Debugf(ctx, "act当前更新数据库: %v 条", updateCount) + g.Log().Debugf(ctx, "Cache2Sql运行结束,act当前更新数据库: %v 条", updateCount) update = (update)[:0] } @@ -479,7 +479,7 @@ func (s *sGameAct) Cache2Sql(ctx context.Context, add, update []*entity.GameAct) } addCount++ if addCount > TaskMax { - g.Log().Debugf(ctx, "act当前写入数据库: %v 条", addCount) + g.Log().Debugf(ctx, "超过%v条,act当前写入数据库: %v 条", TaskMax, addCount) err = tx.Commit() if err != nil { g.Log().Debugf(ctx, "act当前写入数据库失败:%v", err) @@ -489,11 +489,11 @@ func (s *sGameAct) Cache2Sql(ctx context.Context, add, update []*entity.GameAct) tx, err = g.DB().Begin(ctx) } //删除缓存 - //s.DelCacheKey(ctx, v.ActId, v.Uid) + s.DelCacheKey(ctx, v.ActId, v.Uid) } //循环结束了,最后写入一波 - g.Log().Debugf(ctx, "act当前写入数据库: %v 条", addCount) + g.Log().Debugf(ctx, "Cache2Sql运行结束,act当前写入数据库: %v 条", addCount) add = (add)[:0] } @@ -545,7 +545,7 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan * addCount += row if addCount > TaskMax { - g.Log().Debugf(ctx, "act当前写入数据库: %v 条", addCount) + g.Log().Debugf(ctx, "超过%v条,act当前写入数据库: %v 条", TaskMax, addCount) err = tx.Commit() if err != nil { g.Log().Debugf(ctx, "act当前写入数据库失败:%v", err) @@ -556,7 +556,7 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan * } //删除缓存 - //s.DelCacheKey(ctx, v.ActId, v.Uid) + s.DelCacheKey(ctx, v.ActId, v.Uid) case v, ok := <-updateChan: if !ok { @@ -579,10 +579,10 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan * updateCount++ if updateCount > TaskMax { - g.Log().Debugf(ctx, "act当前写入数据库: %v 条", addCount) + g.Log().Debugf(ctx, "超过%v条,act当前更新数据库: %v 条", TaskMax, updateCount) err = tx.Commit() if err != nil { - g.Log().Debugf(ctx, "act当前写入数据库失败:%v", err) + g.Log().Debugf(ctx, "act当前更新数据库失败:%v", err) return } updateCount = 0 @@ -590,7 +590,7 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan * } //删除缓存 - //s.DelCacheKey(ctx, v.ActId, v.Uid) + s.DelCacheKey(ctx, v.ActId, v.Uid) case <-ctx.Done(): g.Log().Debug(ctx, "act协程被上下文取消") @@ -600,8 +600,8 @@ func (s *sGameAct) Cache2SqlChan(ctx context.Context, addChan, updateChan chan * err = tx.Commit() // 仅在所有通道处理完毕后打印最终计数(移除中间冗余日志) - g.Log().Debugf(ctx, "act当前写入数据库: %v 条", addCount) - g.Log().Debugf(ctx, "act当前更新数据库: %v 条", updateCount) + g.Log().Debugf(ctx, "运行结束act当前写入数据库: %v 条", addCount) + g.Log().Debugf(ctx, "运行结束act当前更新数据库: %v 条", updateCount) return }