diff options
| author | AKP <tom@tdpain.net> | 2022-04-06 19:24:08 +0100 |
|---|---|---|
| committer | AKP <tom@tdpain.net> | 2022-04-06 19:24:08 +0100 |
| commit | af45a42d8cc970a541ad66f5c85ead01b6cbde30 (patch) | |
| tree | 0137f9d831b2efdb294689bc76241431c9c7e64d | |
| parent | 83c2066f164b5f79ae44a58afe17fa633e3f3be8 (diff) | |
Fix first hourly job running for the wrong hour
Signed-off-by: AKP <tom@tdpain.net>
| -rw-r--r-- | walrss/internal/rss/watcher.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/walrss/internal/rss/watcher.go b/walrss/internal/rss/watcher.go index f832c12..62f12af 100644 --- a/walrss/internal/rss/watcher.go +++ b/walrss/internal/rss/watcher.go @@ -10,9 +10,7 @@ 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-time.Now().UTC().Minute()) timeUntilNextHour += 30 * time.Second // little bit of buffer time to // make sure we're actually going to be within in the new hour @@ -20,7 +18,7 @@ func StartWatcher(st *state.State) { time.Sleep(timeUntilNextHour) - runFeedProcessor(st, currentTime) + runFeedProcessor(st, time.Now().UTC()) log.Debug().Str("location", "feed watcher").Msg("starting ticker") |
