Add logging for timeline fetching
continuous-integration/drone/push Build is passing Details

pull/10/head
Peter Stuifzand 3 years ago
parent dcff9a4890
commit 9d81cc9a3a
Signed by: peter
GPG Key ID: 374322D56E5209E8

@ -731,8 +731,8 @@ func (b *memoryBackend) updateChannelUnreadCount(channel string) error {
b.lock.RUnlock()
if exists {
timeline := b.getTimeline(channel)
unread, err := timeline.Count()
tl := b.getTimeline(channel)
unread, err := tl.Count()
if err != nil {
return err
}
@ -834,7 +834,11 @@ func (b *memoryBackend) getTimeline(channel string) timeline.Backend {
}
}
return timeline.Create(channel, timelineType, b.pool, b.database)
tl := timeline.Create(channel, timelineType, b.pool, b.database)
if tl == nil {
log.Printf("no timeline found with name %q and type %q", channel, timelineType)
}
return tl
}
func (b *memoryBackend) createChannel(name string) microsub.Channel {

@ -31,6 +31,7 @@ type Backend interface {
// Create creates a channel of the specified type. Return nil when the type
// is not known.
func Create(channel, timelineType string, pool *redis.Pool, db *sql.DB) Backend {
log.Printf("fetching timeline with type %s", timelineType)
if timelineType == "sorted-set" {
timeline := &redisSortedSetTimeline{channel: channel, pool: pool}
err := timeline.Init()

Loading…
Cancel
Save