From 510ab05073cfc8f58f703d46d9cafdc79f3f8e50 Mon Sep 17 00:00:00 2001 From: AKP Date: Wed, 6 Apr 2022 17:28:13 +0100 Subject: Add debugging statements Signed-off-by: AKP --- walrss/internal/rss/watcher.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/walrss/internal/rss/watcher.go b/walrss/internal/rss/watcher.go index c29cb69..f832c12 100644 --- a/walrss/internal/rss/watcher.go +++ b/walrss/internal/rss/watcher.go @@ -8,17 +8,22 @@ import ( ) func StartWatcher(st *state.State) { + log.Debug().Str("location", "feed watcher").Msg("starting feed watcher") go func() { currentTime := time.Now().UTC() - - timeUntilNextHour := time.Minute * time.Duration(60 - currentTime.Minute()) + + timeUntilNextHour := time.Minute * time.Duration(60-currentTime.Minute()) timeUntilNextHour += 30 * time.Second // little bit of buffer time to // make sure we're actually going to be within in the new hour - + + log.Debug().Str("location", "feed watcher").Msgf("waiting %.2f minutes before starting ticker", timeUntilNextHour.Minutes()) + time.Sleep(timeUntilNextHour) runFeedProcessor(st, currentTime) + log.Debug().Str("location", "feed watcher").Msg("starting ticker") + ticker := time.NewTicker(time.Hour) for range ticker.C { // Yes, I am aware that you can get the current time from ticker.C @@ -31,7 +36,7 @@ func StartWatcher(st *state.State) { func runFeedProcessor(st *state.State, currentTime time.Time) { currentTime = currentTime.UTC() - log.Info(). + log.Debug(). Str("location", "feed watcher"). Str("day", db.SendDayFromWeekday(currentTime.Weekday()).String()). Int("hour", currentTime.Hour()). -- cgit v1.2.3-70-g09d2