From 209e7510c1bf93a255e778a1b02ce75ccd474c9e Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Tue, 3 Jul 2018 22:44:53 +0200 Subject: [PATCH] Create channel information when creating channel --- cmd/eksterd/memory.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/eksterd/memory.go b/cmd/eksterd/memory.go index 231d632..599d868 100644 --- a/cmd/eksterd/memory.go +++ b/cmd/eksterd/memory.go @@ -162,6 +162,10 @@ func (b *memoryBackend) ChannelsGetList() []microsub.Channel { // ChannelsCreate creates a channels func (b *memoryBackend) ChannelsCreate(name string) microsub.Channel { defer b.save() + + conn := pool.Get() + defer conn.Close() + uid := fmt.Sprintf("%04d", b.NextUid) channel := microsub.Channel{ UID: uid, @@ -171,6 +175,9 @@ func (b *memoryBackend) ChannelsCreate(name string) microsub.Channel { b.Channels[channel.UID] = channel b.Feeds[channel.UID] = []microsub.Feed{} b.NextUid++ + + conn.Do("SADD", "channels", uid) + conn.Do("SETNX", "channel_sortorder_"+uid, 99999) return channel }