From 7219c895d8c77a39aa22c83798ac2aacab515bd5 Mon Sep 17 00:00:00 2001 From: Mendel E Date: Fri, 1 May 2020 17:05:41 -0400 Subject: [PATCH] Reindex data every 10 minutes This will check for new comics, and update if needed. --- main.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 72934b0..d52567e 100644 --- a/main.go +++ b/main.go @@ -95,11 +95,17 @@ func main() { // index data go func(bot *Bot) { - log.Println("Starting indexing data") - if err := bot.Update(); err != nil { - log.Fatal(err) + t := time.NewTicker(10 * time.Minute) + for { + log.Println("Starting indexing data") + if err := bot.Update(); err != nil { + log.Fatal(err) + } + log.Println("Done indexing data") + + // wait for next tick + <-t.C } - log.Println("Done indexing data") }(bot) // parse updates -- 2.45.2