Skip to content

Commit

Permalink
Clarify dial vs connection timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Batschelet <[email protected]>
  • Loading branch information
hexfusion committed Oct 2, 2023
1 parent a2718e9 commit 15d0a83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vms/rpcchainvm/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (f *factory) New(log logging.Logger) (interface{}, error) {
// any error after the dial timeout.
failFastConn, err := grpcutils.Dial(
status.Addr,
grpcutils.WithConnectTimeout(grpcutils.FailFastDialTimeout),
grpcutils.WithConnectTimeout(grpcutils.FailFastConnectionTimeout),
grpcutils.WithWaitForReady(false),
)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions vms/rpcchainvm/grpcutils/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
)

const (
// FailFastDialTimeout is the amount of time to wait for a connection to be
// FailFastConnectionTimeout is the amount of time to wait for a connection to be
// established before failing.
FailFastDialTimeout = 2 * time.Second
FailFastConnectionTimeout = 2 * time.Second
// After a duration of this time if the client doesn't see any activity it
// pings the server to see if the transport is still alive.
// If set below 10s, a minimum value of 10s will be used instead.
Expand Down
4 changes: 2 additions & 2 deletions vms/rpcchainvm/vm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (vm *VMClient) Shutdown(ctx context.Context) error {
errs := wrappers.Errs{}
// Shutdown is a special case, where we don't want to wait for the
// connection to be "ready" and instead want to "fail fast". The client
// will timeout after the grpcutils.FailFastDialTimeout if it can't
// will timeout after the grpcutils.FailFastConnectionTimeout if it can't
// establish a connection.
_, err := vm.failFastClient.Shutdown(ctx, &emptypb.Empty{})
errs.Add(err)
Expand Down Expand Up @@ -534,7 +534,7 @@ func (vm *VMClient) SetPreference(ctx context.Context, blkID ids.ID) error {
func (vm *VMClient) HealthCheck(ctx context.Context) (interface{}, error) {
// HealthCheck is a special case, where we don't want to wait for the
// connection to be "ready" and instead want to "fail fast". The client
// will timeout after the grpcutils.FailFastDialTimeout if it can't
// will timeout after the grpcutils.FailFastConnectionTimeout if it can't
// establish a connection.
health, err := vm.failFastClient.Health(ctx, &emptypb.Empty{})
if err != nil {
Expand Down

0 comments on commit 15d0a83

Please sign in to comment.