From 41cf3b366e90ff7329d757c6d2f244b0093c2b1e Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Wed, 9 Oct 2024 17:37:45 +0800 Subject: [PATCH 1/3] feat: online and offline webhook --- internal/msggateway/online.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/msggateway/online.go b/internal/msggateway/online.go index 27b4544aaa..22a9e38e38 100644 --- a/internal/msggateway/online.go +++ b/internal/msggateway/online.go @@ -90,6 +90,14 @@ func (ws *WsServer) ChangeOnlineStatus(concurrent int) { if _, err := ws.userClient.Client.SetUserOnlineStatus(ctx, req); err != nil { log.ZError(ctx, "update user online status", err) } + for _, ss := range req.Status { + for _, online := range ss.Online { + ws.webhookAfterUserOnline(ctx, &ws.msgGatewayConfig.WebhooksConfig.AfterUserOnline, ss.UserID, int(online), false, ss.ConnID) + } + for _, offline := range ss.Offline { + ws.webhookAfterUserOffline(ctx, &ws.msgGatewayConfig.WebhooksConfig.AfterUserOffline, ss.UserID, int(offline), ss.ConnID) + } + } } for i := 0; i < concurrent; i++ { From 422aa290302567993cb1c2a0216ce87084ebbfe2 Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Mon, 14 Oct 2024 09:54:07 +0800 Subject: [PATCH 2/3] feat: online and offline webhook --- internal/msggateway/online.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/msggateway/online.go b/internal/msggateway/online.go index 22a9e38e38..f29869b6e5 100644 --- a/internal/msggateway/online.go +++ b/internal/msggateway/online.go @@ -92,7 +92,12 @@ func (ws *WsServer) ChangeOnlineStatus(concurrent int) { } for _, ss := range req.Status { for _, online := range ss.Online { - ws.webhookAfterUserOnline(ctx, &ws.msgGatewayConfig.WebhooksConfig.AfterUserOnline, ss.UserID, int(online), false, ss.ConnID) + client, _, _ := ws.clients.Get(ss.UserID, int(online)) + back := false + if len(client) > 0 { + back = client[0].IsBackground + } + ws.webhookAfterUserOnline(ctx, &ws.msgGatewayConfig.WebhooksConfig.AfterUserOnline, ss.UserID, int(online), back, ss.ConnID) } for _, offline := range ss.Offline { ws.webhookAfterUserOffline(ctx, &ws.msgGatewayConfig.WebhooksConfig.AfterUserOffline, ss.UserID, int(offline), ss.ConnID) From 49b08f9d9992cfd129364766b94f391006bd0eeb Mon Sep 17 00:00:00 2001 From: icey-yu <1186114839@qq.com> Date: Mon, 14 Oct 2024 10:38:13 +0800 Subject: [PATCH 3/3] feat: remove zk --- config/discovery.yml | 5 ----- docker-compose.yml | 14 +------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/config/discovery.yml b/config/discovery.yml index 78a36f3d1f..6e68cbff46 100644 --- a/config/discovery.yml +++ b/config/discovery.yml @@ -5,9 +5,4 @@ etcd: username: '' password: '' -zookeeper: - schema: openim - address: [ localhost:12181 ] - username: '' - password: '' diff --git a/docker-compose.yml b/docker-compose.yml index edac65b13e..6d88bac10e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,19 +43,6 @@ services: networks: - openim - zookeeper: - image: "${ZOOKEEPER_IMAGE}" - container_name: zookeeper - ports: - - "12181:2181" - environment: - #JVMFLAGS: "-Xms32m -Xmx128m" - TZ: "Asia/Shanghai" - ALLOW_ANONYMOUS_LOGIN: "yes" - restart: always - networks: - - openim - etcd: image: "${ETCD_IMAGE}" container_name: etcd @@ -142,6 +129,7 @@ services: # image: ${PROMETHEUS_IMAGE} # container_name: prometheus # restart: always +# user: root # volumes: # - ./config/prometheus.yml:/etc/prometheus/prometheus.yml # - ./config/instance-down-rules.yml:/etc/prometheus/instance-down-rules.yml