die if webserver dies

This commit is contained in:
Josh Deprez 2021-01-04 10:43:04 +11:00
parent 1507dcc158
commit 833dcb07f6

View file

@ -139,7 +139,9 @@ func main() {
client := modbus.NewClient(handler)
scrape(client)
// Start http interface only after first successful scrape
go http.ListenAndServe(*httpAddr, nil)
go func() {
die("http.ListenAndServe: %v", http.ListenAndServe(*httpAddr, nil))
}()
for range time.Tick(*scrapeInterval) {
scrape(client)
}