Skip to content

Commit 6a25629

Browse files
close the connection on each healthcheck to fix - too many open files error
Signed-off-by: Krasi Georgiev <[email protected]>
1 parent be29383 commit 6a25629

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@ func main() {
8484
}
8585
for {
8686
time.Sleep(interval / 3)
87-
_, err := http.Get("http://127.0.0.1:" + srvConfig.Port)
87+
res, err := http.Get("http://127.0.0.1:" + srvConfig.Port)
8888
if err == nil {
8989
daemon.SdNotify(false, "WATCHDOG=1")
9090
} else {
9191
log.Printf("RPi Controller watchdog error: %v", err)
9292
}
93+
res.Body.Close()
9394
}
9495
}()
9596
return shutdown(quit, srv)

0 commit comments

Comments
 (0)