dba5389efd8ee1de58f18f85c04c50676161eef7 — Louis Solofrizzo a month ago 71e51ca
bot: Add infinite retry on error

Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>
1 files changed, 2 insertions(+), 0 deletions(-)

M bot/main.go
M bot/main.go => bot/main.go +2 -0
@@ 44,11 44,13 @@   	DB.Limit(1).Order("RANDOM()").Where("sent = 0").Find(&entries)
  	for _, people := range Config.Bot.People {
+ 	retry:
  		out, err := exec.Command("sudo", "-u", "keybase", "keybase", "chat", "send", people, Config.Bot.CDN+"/"+entries[0].Name).Output()
  		if err == nil {
  			DB.Model(&entries[0]).Update("sent", true)
  		} else {
  			fmt.Printf("Error: %s, '%s'\n", err.Error(), out)
+ 			goto retry
  		}
  	}
  }