Extract updateChannelInRedis

This commit is contained in:
Peter Stuifzand 2018-10-03 18:56:26 +02:00
parent cec5fd0672
commit 2288e70e85
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -227,16 +227,18 @@ func (b *memoryBackend) ChannelsCreate(name string) (microsub.Channel, error) {
channel := b.createChannel(name)
b.setChannel(channel)
b.setChannel(channel)
conn := pool.Get()
defer conn.Close()
updateChannelInRedis(channel, conn)
return channel, nil
}
func updateChannelInRedis(channel microsub.Channel, conn redis.Conn) {
uid := channel.UID
conn.Do("SADD", "channels", uid)
conn.Do("SETNX", "channel_sortorder_"+uid, 99999)
return channel, nil
}
// ChannelsUpdate updates a channels