Add logging for timeline fetching
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-05-13 21:56:23 +02:00
parent dcff9a4890
commit 9d81cc9a3a
Signed by: peter
GPG Key ID: 374322D56E5209E8
2 changed files with 8 additions and 3 deletions

View File

@ -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 {

View File

@ -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()