Skip to content

Commit

Permalink
fix timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
nii236 committed Sep 23, 2024
1 parent da9310f commit 0075412
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli/core/beaconClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ type BeaconClient interface {
}

type beaconClient struct {
timeout time.Duration
eth2client eth2client.Service
verbose bool
}

func NewBeaconClient(endpoint string, verbose bool, timeout time.Duration) (BeaconClient, context.CancelFunc, error) {
beaconClient := beaconClient{verbose: verbose}
beaconClient := beaconClient{verbose: verbose, timeout: timeout}
ctx, cancel := context.WithCancel(context.Background())

client, err := http.New(ctx,
Expand Down Expand Up @@ -106,13 +107,12 @@ func (b *beaconClient) GetValidator(ctx context.Context, index uint64) (*v1.Vali
}

func (b *beaconClient) GetBeaconState(ctx context.Context, stateId string) (*spec.VersionedBeaconState, error) {
timeout, _ := time.ParseDuration("200s")
if provider, ok := b.eth2client.(eth2client.BeaconStateProvider); ok {
if b.verbose {
log.Info().Msgf("downloading beacon state %s", stateId)
}
opts := &api.BeaconStateOpts{State: stateId, Common: api.CommonOpts{
Timeout: timeout,
Timeout: b.timeout,
}}
beaconState, err := provider.BeaconState(ctx, opts)
if err != nil {
Expand Down

0 comments on commit 0075412

Please sign in to comment.