From 296e2c03af9d56ffd3187f43769034d0013e2091 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sun, 17 Apr 2022 14:59:58 +0200 Subject: [PATCH] Problem: when logging UpdateFeed calls we only see channel Id Solution: show channel name --- cmd/eksterd/hubbackend.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cmd/eksterd/hubbackend.go b/cmd/eksterd/hubbackend.go index f3254ec..102628b 100644 --- a/cmd/eksterd/hubbackend.go +++ b/cmd/eksterd/hubbackend.go @@ -135,15 +135,14 @@ func (h *hubIncomingBackend) UpdateFeed(processor ContentProcessor, subscription log.Println("UpdateFeed", subscriptionID) db := h.database - var ( - topic string - channel string - feedID string - ) - // Process all channels that contains this feed - rows, err := db.Query( - `select topic, c.uid, f.id from subscriptions s inner join feeds f on f.url = s.topic inner join channels c on c.id = f.channel_id where s.id = $1`, + rows, err := db.Query(` +select topic, c.uid, f.id, c.name +from subscriptions s +inner join feeds f on f.url = s.topic +inner join channels c on c.id = f.channel_id +where s.id = $1 +`, subscriptionID, ) if err != nil { @@ -151,16 +150,18 @@ func (h *hubIncomingBackend) UpdateFeed(processor ContentProcessor, subscription } for rows.Next() { - err = rows.Scan(&topic, &channel, &feedID) + var topic, channel, feedID, channelName string + + err = rows.Scan(&topic, &channel, &feedID, &channelName) if err != nil { log.Println(err) continue } - log.Printf("Updating feed %s %q in %q\n", feedID, topic, channel) + log.Printf("Updating feed %s %q in %q (%s)\n", feedID, topic, channelName, channel) _, err = processor.ProcessContent(channel, feedID, topic, contentType, body) if err != nil { - log.Printf("could not process content for channel %s: %s", channel, err) + log.Printf("could not process content for channel %s: %s", channelName, err) } }