From a5c85c6cdb415c808939e3e6568fb144b0edfc00 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Mon, 31 Jul 2023 10:47:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=BB=98=E8=AE=A4=E6=98=AF3=E7=A7=92?= =?UTF-8?q?=E8=B6=85=E6=97=B6=EF=BC=8C=E7=8E=B0=E5=9C=A8155=E5=8A=A0?= =?UTF-8?q?=E5=A4=A7=E4=B8=80=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc/user_center.go | 8 ++++++-- rpc/user_center_func.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rpc/user_center.go b/rpc/user_center.go index e680dae..9a1f555 100644 --- a/rpc/user_center.go +++ b/rpc/user_center.go @@ -136,8 +136,12 @@ func init() { } } -func multicast(uids []uint64, msgType uint32, data []byte) ([]uint64, error) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*3) +func multicast(uids []uint64, msgType uint32, data []byte, seconds ...time.Duration) ([]uint64, error) { + duration := time.Duration(3) + if len(seconds) > 0 { + duration = seconds[0] + } + ctx, cancel := context.WithTimeout(context.Background(), time.Second*duration) defer cancel() rsp, err := userClient.Multicast(ctx, &userCenter.MulticastMessage{ Uids: uids, diff --git a/rpc/user_center_func.go b/rpc/user_center_func.go index 68bfdcd..c8a4cb5 100644 --- a/rpc/user_center_func.go +++ b/rpc/user_center_func.go @@ -419,7 +419,7 @@ func SendSocketMicChange(seqId string, userId uint64, micUserExternalId, txGroup n := 0 for { n++ - rspUids, err = multicast(userIds, MsgTypeGroupMicChange, buffer) + rspUids, err = multicast(userIds, MsgTypeGroupMicChange, buffer, time.Duration(10)) if n >= 3 || len(rspUids) <= 0 { break } -- 2.22.0