Browse Source

client: use vars for retry intervals

pull/1780/head
Ethan Buchman 7 years ago
parent
commit
bb141794c8
3 changed files with 8 additions and 3 deletions
  1. +5
    -0
      client/client.go
  2. +2
    -2
      client/grpc_client.go
  3. +1
    -1
      client/socket_client.go

+ 5
- 0
client/client.go View File

@ -8,6 +8,11 @@ import (
cmn "github.com/tendermint/tmlibs/common"
)
const (
dialRetryIntervalSeconds = 3
echoRetryIntervalSeconds = 1
)
// Client defines an interface for an ABCI client.
// All `Async` methods return a `ReqRes` object.
// All `Sync` methods return the appropriate protobuf ResponseXxx struct and an error.


+ 2
- 2
client/grpc_client.go View File

@ -56,7 +56,7 @@ RETRY_LOOP:
return err
}
cli.Logger.Error(fmt.Sprintf("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
time.Sleep(time.Second * 3)
time.Sleep(time.Second * dialRetryIntervalSeconds)
continue RETRY_LOOP
}
@ -68,7 +68,7 @@ RETRY_LOOP:
if err == nil {
break ENSURE_CONNECTED
}
time.Sleep(time.Second)
time.Sleep(time.Second * echoRetryIntervalSeconds)
}
cli.client = client


+ 1
- 1
client/socket_client.go View File

@ -68,7 +68,7 @@ RETRY_LOOP:
return err
}
cli.Logger.Error(fmt.Sprintf("abci.socketClient failed to connect to %v. Retrying...", cli.addr))
time.Sleep(time.Second * 3)
time.Sleep(time.Second * dialRetryIntervalSeconds)
continue RETRY_LOOP
}
cli.conn = conn


Loading…
Cancel
Save