Skip to content
Snippets Groups Projects
Commit 76f678bb authored by Jono Wenger's avatar Jono Wenger
Browse files

Add graceful termination

parent f577a9b5
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ import ( ...@@ -9,6 +9,8 @@ import (
"io/fs" "io/fs"
"io/ioutil" "io/ioutil"
"os" "os"
"os/signal"
"syscall"
"time" "time"
"gitlab.com/elixxir/client/connect" "gitlab.com/elixxir/client/connect"
...@@ -161,5 +163,17 @@ func main() { ...@@ -161,5 +163,17 @@ func main() {
// Keep app running to receive messages----------------------------------------------- // Keep app running to receive messages-----------------------------------------------
select {} // Wait until the user terminates the program
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c
err = e2eClient.StopNetworkFollower()
if err != nil {
jww.ERROR.Printf("Failed to stop network follower: %+v", err)
} else {
jww.INFO.Printf("Stopped network follower.")
}
os.Exit(0)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment