~mendelmaleh/tg_xkcdbot

7219c895d8c77a39aa22c83798ac2aacab515bd5 — Mendel E 2 years ago bc3a95d
Reindex data every 10 minutes

This will check for new comics, and update if needed.
1 files changed, 10 insertions(+), 4 deletions(-)

M main.go
M main.go => main.go +10 -4
@@ 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