aboutsummaryrefslogtreecommitdiff
path: root/cmd/sapientwindex
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-10-18 06:20:04 -0400
committerXe Iaso <me@xeiaso.net>2023-10-18 06:20:04 -0400
commitd9c24d3d38eaf9b2da4bcd5d042d8691b697e7dc (patch)
tree0065f3349a643dfdd3820294c70e7c5ffcb2afa8 /cmd/sapientwindex
parent00f1ac0ce57e561d7fd8d0756845dccd781f5117 (diff)
downloadx-d9c24d3d38eaf9b2da4bcd5d042d8691b697e7dc.tar.xz
x-d9c24d3d38eaf9b2da4bcd5d042d8691b697e7dc.zip
cmd/sapientwindex: retry scanning in a loopv1.8.3
So apparently this bot was randomly exiting with status code 0. I checked the vendor closure of the library and found out that this was not an intentional call made in any of the code I'm calling. Nope. Turns out this is everything working as intended because when execution gets to the end of `func main`, Go inserts a `syscall.Exit(0)` for you. This was fixed by inserting a "wait 5 seconds after each retry" loop. If this becomes a problem, I'll probably switch to using /x/cardio to have it float between 30 seconds and an hour. Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd/sapientwindex')
-rw-r--r--cmd/sapientwindex/main.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd/sapientwindex/main.go b/cmd/sapientwindex/main.go
index 97d89a9..f13d820 100644
--- a/cmd/sapientwindex/main.go
+++ b/cmd/sapientwindex/main.go
@@ -38,14 +38,18 @@ func main() {
Logger: slog.NewLogLogger(slog.Default().Handler(), slog.LevelInfo),
}
- stop, wait, err := graw.Scan(announce, handle, scriptCfg)
- if err != nil {
- log.Fatal(err)
- }
+ for {
+ stop, wait, err := graw.Scan(announce, handle, scriptCfg)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ defer stop()
- defer stop()
+ wait()
- wait()
+ time.Sleep(5 * time.Second)
+ }
}
type announcer struct{}