aboutsummaryrefslogtreecommitdiffstats
path: root/walrss/internal
diff options
context:
space:
mode:
Diffstat (limited to 'walrss/internal')
-rw-r--r--walrss/internal/rss/watcher.go13
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()).