small pixel drawing of a pufferfish vore

Refresh every 15 minutes, dont refresh unless its time
Jes Olson j3s@c3f.net
Wed, 22 Mar 2023 17:16:30 -0700
commit

cb2c8e9ec7e5b5a37667a3aa1ae9a0ce2a308fff

parent

06e407f8ff4c385bb5fba84c030e683688386304

1 files changed, 5 insertions(+), 1 deletions(-)

jump to
M reaper/reaper.goreaper/reaper.go

@@ -48,7 +48,7 @@ }

for { r.updateAll() - time.Sleep(2 * time.Hour) + time.Sleep(15 * time.Minute) } }

@@ -85,6 +85,10 @@

// updateFeed triggers a fetch on the given feed, // and sets a fetch error in the db if there is one. func (r *Reaper) updateFeed(f *rss.Feed) { + // return early if it's not time to refresh yet + if !f.Refresh.After(time.Now()) { + return + } err := f.Update() if err != nil { fmt.Printf("[err] reaper: fetch failure url '%s' %s\n", f.UpdateURL, err)