From d1e920d95d1e3e7e402b7213a9ab1423cafbb2f5 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 7 Aug 2023 11:59:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89err||uid=E4=B8=8D=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E6=89=8D=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/user_center_func.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index f034683..15a99b1 100644 --- a/rpc/user_center_func.go +++ b/rpc/user_center_func.go @@ -427,11 +427,14 @@ func SendSocketMicChange(seqId string, userId uint64, micUserExternalId, txGroup time.Sleep(time.Millisecond * 200) } - //记录socket,注意闭包问题 - go func(userId uint64, msg *userProxy.GroupMicChange, rspUids []uint64, err error) { - buf, _ := json.Marshal(msg) - AddRpcLog(MsgTypeGroupMicChange, userId, string(buf[:]), rspUids, err) - }(userId, msg, rspUids, err) + // 记录socket + // 有err||uid不在线才入库 + if err != nil || len(rspUids) > 0 { + go func(userId uint64, msg *userProxy.GroupMicChange, rspUids []uint64, err error) { + buf, _ := json.Marshal(msg) + AddRpcLog(MsgTypeGroupMicChange, userId, string(buf[:]), rspUids, err) + }(userId, msg, rspUids, err) + } if err != nil { mylogrus.MyLog.Errorf("grpc SendSocketMicChange send fail,seqId:%v,retry:%v,data:%v,err:%v", seqId, n, *msg, err) -- 2.22.0