diff options
| author | AKP <tom@tdpain.net> | 2022-04-06 17:28:13 +0100 |
|---|---|---|
| committer | AKP <tom@tdpain.net> | 2022-04-06 17:28:13 +0100 |
| commit | 510ab05073cfc8f58f703d46d9cafdc79f3f8e50 (patch) | |
| tree | 3ed61ba0dc05ffbda61e4b0596ada8b6bbef5346 | |
| parent | a4d3dcc4c283029b8a4f5e33f85fbb52bf3c52d2 (diff) | |
Add debugging statements
Signed-off-by: AKP <tom@tdpain.net>
| -rw-r--r-- | walrss/internal/rss/watcher.go | 13 |
1 files 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()). |
