From 5926c095853b4f860d68312adf41f9b5743d416c Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 18 Jul 2022 11:20:29 -0400 Subject: [PATCH] reddit api worse then others, use longer wait and try again --- nun.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nun.go b/nun.go index 6a14ba4..62e1d0c 100644 --- a/nun.go +++ b/nun.go @@ -31,6 +31,11 @@ func (n *nunWatch) Main() { log.Fatal("fail count too high; ending loop") return } + if n.fail > 3 { + log.Println("over three failures, increasing tick time to 5 minutes") + ticker.Reset(5 * time.Minute) + continue + } newPost, err := getNewestPost("LittleNuns") if err != nil { log.Printf("error getting newest post: %v", err) @@ -38,7 +43,11 @@ func (n *nunWatch) Main() { n.fail++ continue } - n.fail = 0 + if n.fail != 0 { + n.fail = 0 + ticker.Reset(30 * time.Second) + } + if n.curPost.Title != newPost.Title { n.curPost = newPost roomResp, err := n.client.JoinedRooms()