Move getTimeline to memory.go
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2019-03-23 20:43:22 +01:00
parent a23b31cefe
commit 42431954e2
Signed by: peter
GPG Key ID: 374322D56E5209E8
2 changed files with 16 additions and 20 deletions

View File

@ -19,6 +19,7 @@ import (
"p83.nl/go/ekster/pkg/fetch" "p83.nl/go/ekster/pkg/fetch"
"p83.nl/go/ekster/pkg/microsub" "p83.nl/go/ekster/pkg/microsub"
"p83.nl/go/ekster/pkg/server" "p83.nl/go/ekster/pkg/server"
"p83.nl/go/ekster/pkg/timeline"
"p83.nl/go/ekster/pkg/util" "p83.nl/go/ekster/pkg/util"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
@ -725,6 +726,21 @@ func Fetch2(fetchURL string) (*http.Response, error) {
return resp, err return resp, err
} }
func (b *memoryBackend) getTimeline(channel string) timeline.Backend {
timelineType := "sorted-set"
if channel == "notifications" {
timelineType = "stream"
} else {
if setting, ok := b.Settings[channel]; ok {
if setting.ChannelType != "" {
timelineType = setting.ChannelType
}
}
}
return timeline.Create(channel, timelineType, b.pool)
}
func (b *memoryBackend) createChannel(name string) microsub.Channel { func (b *memoryBackend) createChannel(name string) microsub.Channel {
uid := fmt.Sprintf("%012d", b.NextUID) uid := fmt.Sprintf("%012d", b.NextUID)
channel := microsub.Channel{ channel := microsub.Channel{

View File

@ -1,20 +0,0 @@
package main
import (
"p83.nl/go/ekster/pkg/timeline"
)
func (b *memoryBackend) getTimeline(channel string) timeline.Backend {
timelineType := "sorted-set"
if channel == "notifications" {
timelineType = "stream"
} else {
if setting, ok := b.Settings[channel]; ok {
if setting.ChannelType != "" {
timelineType = setting.ChannelType
}
}
}
return timeline.Create(channel, timelineType, b.pool)
}