Create channel information when creating channel

This commit is contained in:
Peter Stuifzand 2018-07-03 22:44:53 +02:00
parent 71a9040eba
commit 209e7510c1

View File

@ -162,6 +162,10 @@ func (b *memoryBackend) ChannelsGetList() []microsub.Channel {
// ChannelsCreate creates a channels // ChannelsCreate creates a channels
func (b *memoryBackend) ChannelsCreate(name string) microsub.Channel { func (b *memoryBackend) ChannelsCreate(name string) microsub.Channel {
defer b.save() defer b.save()
conn := pool.Get()
defer conn.Close()
uid := fmt.Sprintf("%04d", b.NextUid) uid := fmt.Sprintf("%04d", b.NextUid)
channel := microsub.Channel{ channel := microsub.Channel{
UID: uid, UID: uid,
@ -171,6 +175,9 @@ func (b *memoryBackend) ChannelsCreate(name string) microsub.Channel {
b.Channels[channel.UID] = channel b.Channels[channel.UID] = channel
b.Feeds[channel.UID] = []microsub.Feed{} b.Feeds[channel.UID] = []microsub.Feed{}
b.NextUid++ b.NextUid++
conn.Do("SADD", "channels", uid)
conn.Do("SETNX", "channel_sortorder_"+uid, 99999)
return channel return channel
} }