breaking change: make "postgres-stream" the default channel type

This commit is contained in:
Peter Stuifzand 2021-10-21 20:03:03 +02:00
parent b5ec260665
commit fff2a92b72
Signed by: peter
GPG Key ID: 374322D56E5209E8
2 changed files with 5 additions and 16 deletions

View File

@ -374,13 +374,8 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} else { } else {
page.CurrentSetting = channelSetting{} page.CurrentSetting = channelSetting{}
} }
// FIXME: similar code is found in timeline.go
if page.CurrentSetting.ChannelType == "" { if page.CurrentSetting.ChannelType == "" {
if v.UID == "notifications" { page.CurrentSetting.ChannelType = "postgres-stream"
page.CurrentSetting.ChannelType = "stream"
} else {
page.CurrentSetting.ChannelType = "sorted-set"
}
} }
page.ExcludedTypeNames = map[string]string{ page.ExcludedTypeNames = map[string]string{
"repost": "Reposts", "repost": "Reposts",

View File

@ -832,17 +832,11 @@ func Fetch2(fetchURL string) (*http.Response, error) {
} }
func (b *memoryBackend) getTimeline(channel string) timeline.Backend { func (b *memoryBackend) getTimeline(channel string) timeline.Backend {
timelineType := "sorted-set" // Set a default timeline type if not set
if channel == "notifications" { timelineType := "postgres-stream"
timelineType = "stream" if setting, ok := b.Settings[channel]; ok && setting.ChannelType != "" {
} else {
if setting, ok := b.Settings[channel]; ok {
if setting.ChannelType != "" {
timelineType = setting.ChannelType timelineType = setting.ChannelType
} }
}
}
tl := timeline.Create(channel, timelineType, b.pool, b.database) tl := timeline.Create(channel, timelineType, b.pool, b.database)
if tl == nil { if tl == nil {
log.Printf("no timeline found with name %q and type %q", channel, timelineType) log.Printf("no timeline found with name %q and type %q", channel, timelineType)