Skip to content

Commit

Permalink
make the console output less chatty
Browse files Browse the repository at this point in the history
  • Loading branch information
ftl committed May 15, 2022
1 parent 58755b4 commit c09eb74
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 7 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func KeepOpen(host *net.TCPAddr, retryInterval time.Duration, trace bool, listen
client := newClient(host, trace, listeners)
go func() {
disconnected := make(chan bool, 1)
log.Printf("connecting to %s...", host.IP.String())
for {
err := client.connect()
if err == nil {
Expand All @@ -124,12 +125,16 @@ func KeepOpen(host *net.TCPAddr, retryInterval time.Duration, trace bool, listen
return
}
} else {
log.Printf("cannot connect to %s, waiting for retry: %v", host.IP.String(), err)
if trace {
log.Printf("cannot connect to %s, waiting for retry: %v", host.IP.String(), err)
}
}

select {
case <-time.After(retryInterval):
log.Printf("retrying to connect to %s", host.IP.String())
if trace {
log.Printf("retrying to connect to %s", host.IP.String())
}
case <-client.closed:
log.Print("connection closed")
return
Expand Down
10 changes: 9 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
module github.com/ftl/tci

go 1.15
go 1.18

require (
github.com/gorilla/websocket v1.4.2
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.7.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down

0 comments on commit c09eb74

Please sign in to comment.