From d2d797bd915b9b285688b37c82ae606653d559eb Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Tue, 10 Sep 2024 16:31:08 +0800 Subject: [PATCH] fix: ctx --- pkg/rpccache/online.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/rpccache/online.go b/pkg/rpccache/online.go index 172235a57..6ece508a9 100644 --- a/pkg/rpccache/online.go +++ b/pkg/rpccache/online.go @@ -53,7 +53,7 @@ func NewOnlineCache(user rpcclient.UserRpcClient, group *GroupLocalCache, rdb re } go func() { - x.doSubscribe(rdb, fn) + x.doSubscribe(ctx, rdb, fn) }() return x, nil } @@ -135,8 +135,7 @@ func (o *OnlineCache) initUsersOnlineStatus(ctx context.Context) (err error) { return nil } -func (o *OnlineCache) doSubscribe(rdb redis.UniversalClient, fn func(ctx context.Context, userID string, platformIDs []int32)) { - ctx := mcontext.SetOperationID(context.Background(), cachekey.OnlineChannel+strconv.FormatUint(rand.Uint64(), 10)) +func (o *OnlineCache) doSubscribe(ctx context.Context, rdb redis.UniversalClient, fn func(ctx context.Context, userID string, platformIDs []int32)) { o.Lock.Lock() ch := rdb.Subscribe(ctx, cachekey.OnlineChannel).Channel() for o.CurrentPhase < DoOnlineStatusOver {