diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index f034683a3a70d79d10a39ba2aeaeca15b28210f7..15a99b1f527ff52ab48fe2c5f5aeaf7ed00626c3 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)