Update RedisRouter.Publish method to use channel prefix for destination
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-04-24 19:39:12 +02:00
parent a3557d5183
commit 428eda0ab7

View File

@ -110,7 +110,7 @@ func (r *RedisRouter) storeMessage(msg *meowlib.ToServerMessage) (*meowlib.FromS
return nil, err return nil, err
} }
r.Client.ZAdd(usrmsg.Destination, redis.Z{Score: float64(time.Now().Unix()), Member: out}) 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 from_server.UuidAck = msg.Uuid
return &from_server, nil 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{}) { func goSubscribeAndListen(client *redis.Client, key string, messages chan<- string, wg *sync.WaitGroup, done <-chan struct{}) {
defer wg.Done() defer wg.Done()
pubsub := client.Subscribe(key) pubsub := client.Subscribe("ch:" + key)
defer pubsub.Close() defer pubsub.Close()
// Create a new channel for the messages from this subscription // Create a new channel for the messages from this subscription