mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
update notification
This commit is contained in:
parent
d022ba0c78
commit
6481cd59b0
5
go.mod
5
go.mod
@ -34,7 +34,7 @@ require github.com/google/uuid v1.3.1
|
||||
require (
|
||||
github.com/IBM/sarama v1.41.3
|
||||
github.com/OpenIMSDK/protocol v0.0.37
|
||||
github.com/OpenIMSDK/tools v0.0.20
|
||||
github.com/OpenIMSDK/tools v0.0.22
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.9+incompatible
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
github.com/redis/go-redis/v9 v9.2.1
|
||||
@ -154,3 +154,6 @@ require (
|
||||
golang.org/x/crypto v0.14.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
)
|
||||
replace (
|
||||
github.com/OpenIMSDK/protocol v0.0.37 => github.com/AndrewZuo01/protocol v0.0.0-20231226102058-3702dc94b5dd
|
||||
)
|
||||
@ -471,5 +471,7 @@ func (s *friendServer) UpdateFriends(
|
||||
}
|
||||
|
||||
resp := &pbfriend.UpdateFriendsResp{}
|
||||
|
||||
s.notificationSender.FriendsInfoUpdateNotification(ctx, req.OwnerUserID)
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@ -196,7 +196,11 @@ func (f *FriendNotificationSender) FriendRemarkSetNotification(ctx context.Conte
|
||||
tips.FromToUserID.ToUserID = toUserID
|
||||
return f.Notification(ctx, fromUserID, toUserID, constant.FriendRemarkSetNotification, &tips)
|
||||
}
|
||||
|
||||
func (f *FriendNotificationSender) FriendsInfoUpdateNotification(ctx context.Context, toUserID string) error {
|
||||
tips := sdkws.FriendsInfoUpdateTips{}
|
||||
tips.FromToUserID.ToUserID = toUserID
|
||||
return f.Notification(ctx, toUserID, toUserID, constant.FriendsInfoUpdateNotification, &tips)
|
||||
}
|
||||
func (f *FriendNotificationSender) BlackAddedNotification(ctx context.Context, req *pbfriend.AddBlackReq) error {
|
||||
tips := sdkws.BlackAddedTips{FromToUserID: &sdkws.FromToUserID{}}
|
||||
tips.FromToUserID.FromUserID = req.OwnerUserID
|
||||
|
||||
@ -16,6 +16,7 @@ package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net"
|
||||
@ -285,10 +286,23 @@ func checkZookeeper() (string, error) {
|
||||
|
||||
// Connect to Zookeeper
|
||||
str := "the addr is:" + address
|
||||
c, _, err := zk.Connect(zookeeperAddresses, time.Second) // Adjust the timeout as necessary
|
||||
c, eventChan, err := zk.Connect(zookeeperAddresses, time.Second) // Adjust the timeout as necessary
|
||||
if err != nil {
|
||||
return "", errs.Wrap(errStr(err, str))
|
||||
}
|
||||
timeout := time.After(5 * time.Second)
|
||||
for {
|
||||
select {
|
||||
case event := <-eventChan:
|
||||
if event.State == zk.StateConnected {
|
||||
fmt.Println("Connected to Zookeeper")
|
||||
goto Connected
|
||||
}
|
||||
case <-timeout:
|
||||
return "", errs.Wrap(errors.New("timeout waiting for Zookeeper connection"), "Zookeeper Addr: "+strings.Join(config.Config.Zookeeper.ZkAddr, " "))
|
||||
}
|
||||
}
|
||||
Connected:
|
||||
defer c.Close()
|
||||
|
||||
// Set authentication if username and password are provided
|
||||
@ -298,12 +312,6 @@ func checkZookeeper() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if Zookeeper is reachable
|
||||
_, _, err = c.Get("/")
|
||||
if err != nil {
|
||||
return "", errs.Wrap(err, str)
|
||||
}
|
||||
|
||||
return str, nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user