From 428eda0ab79588d9aee14979ff07faefbcb043d1 Mon Sep 17 00:00:00 2001 From: ycc Date: Wed, 24 Apr 2024 19:39:12 +0200 Subject: [PATCH] Update RedisRouter.Publish method to use channel prefix for destination --- server/router.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/router.go b/server/router.go index 73c286e..c3398d0 100644 --- a/server/router.go +++ b/server/router.go @@ -110,7 +110,7 @@ func (r *RedisRouter) storeMessage(msg *meowlib.ToServerMessage) (*meowlib.FromS return nil, err } r.Client.ZAdd(usrmsg.Destination, redis.Z{Score: float64(time.Now().Unix()), Member: out}) - r.Client.Publish(usrmsg.Destination, "!") + r.Client.Publish("ch:"+usrmsg.Destination, "!") } from_server.UuidAck = msg.Uuid return &from_server, nil @@ -172,7 +172,7 @@ func (r *RedisRouter) checkForMessage(msg *meowlib.ToServerMessage) (*meowlib.Fr func goSubscribeAndListen(client *redis.Client, key string, messages chan<- string, wg *sync.WaitGroup, done <-chan struct{}) { defer wg.Done() - pubsub := client.Subscribe(key) + pubsub := client.Subscribe("ch:" + key) defer pubsub.Close() // Create a new channel for the messages from this subscription