mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 12:08:52 +08:00
singal offline push
This commit is contained in:
parent
e428e186f0
commit
78dfba8771
@ -106,29 +106,34 @@ func (d *DataBases) CleanUpOneUserAllMsgFromRedis(userID string, operationID str
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) NewCacheSignalInfo(msg *pbCommon.MsgData) error {
|
func (d *DataBases) NewCacheSignalInfo(msg *pbCommon.MsgData) error {
|
||||||
keyList := SignalListCache + msg.RecvID
|
req := &pbRtc.SignalReq{}
|
||||||
timeout, err := strconv.Atoi(config.Config.Rtc.SignalTimeout)
|
if err := proto.Unmarshal(msg.Content, req); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = d.rdb.LPush(context.Background(), keyList, msg.ClientMsgID).Err()
|
//log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "SignalReq: ", req.String())
|
||||||
if err != nil {
|
switch req.Payload.(type) {
|
||||||
|
case *pbRtc.SignalReq_Invite, *pbRtc.SignalReq_InviteInGroup:
|
||||||
|
keyList := SignalListCache + msg.RecvID
|
||||||
|
timeout, err := strconv.Atoi(config.Config.Rtc.SignalTimeout)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = d.rdb.LPush(context.Background(), keyList, msg.ClientMsgID).Err()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = d.rdb.Expire(context.Background(), keyList, time.Duration(timeout)*time.Second).Err()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
key := SignalCache + msg.ClientMsgID
|
||||||
|
err = d.rdb.Set(context.Background(), key, msg.Content, time.Duration(timeout)*time.Second).Err()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = d.rdb.Expire(context.Background(), keyList, time.Duration(timeout)*time.Second).Err()
|
return nil
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
key := SignalCache + msg.ClientMsgID
|
|
||||||
err = d.rdb.Set(context.Background(), key, msg.Content, time.Duration(timeout)*time.Second).Err()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = d.rdb.Expire(context.Background(), key, time.Duration(timeout)*time.Second).Err()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) GetSignalInfoFromCacheByClientMsgID(clientMsgID string) (invitationInfo *pbRtc.SignalInviteReq, err error) {
|
func (d *DataBases) GetSignalInfoFromCacheByClientMsgID(clientMsgID string) (invitationInfo *pbRtc.SignalInviteReq, err error) {
|
||||||
|
@ -33,7 +33,7 @@ const (
|
|||||||
groupCache = "GROUP_CACHE:"
|
groupCache = "GROUP_CACHE:"
|
||||||
messageCache = "MESSAGE_CACHE:"
|
messageCache = "MESSAGE_CACHE:"
|
||||||
SignalCache = "SIGNAL_CACHE:"
|
SignalCache = "SIGNAL_CACHE:"
|
||||||
SignalListCache = "SIGNAL_ZSET_CACHE:"
|
SignalListCache = "SIGNAL_LIST_CACHE:"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {
|
func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user