Created
March 23, 2021 20:24
-
-
Save patricklodder/f47a1e5fd03ddaf1e29a83c81c181edf to your computer and use it in GitHub Desktop.
network status probe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/main.go b/main.go | |
index fd397b0..5123269 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -189,6 +189,21 @@ func main() { | |
return server.Shutdown(ctx) | |
}) | |
+ ticker := time.NewTicker(5 * time.Second) | |
+ quit := make(chan struct{}) | |
+ go func() { | |
+ for { | |
+ select { | |
+ case <- ticker.C: | |
+ _, clienterr := client.NetworkStatus(ctx) | |
+ logger.Infow("client status", "err", clienterr) | |
+ case <- quit: | |
+ ticker.Stop() | |
+ return | |
+ } | |
+ } | |
+ }() | |
+ | |
err = g.Wait() | |
// We always want to attempt to close the database, regardless of the error. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
apply with
git apply add_net_status_probe.patch