Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjusted timeouts. added retry loop over create channels #426

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 36 additions & 28 deletions relayer/create_ibc_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (r *Relayer) CreateIBCChannel(override bool, logFileOption utils.CommandOpt
updateClientsCmd := r.GetUpdateClientsCmd()
return utils.ExecBashCmd(updateClientsCmd, logFileOption)
},
retry.Delay(time.Duration(10)*time.Second),
retry.Delay(time.Duration(30)*time.Second),
retry.DelayType(retry.FixedDelay),
retry.Attempts(5),
retry.OnRetry(func(n uint, err error) {
Expand All @@ -55,39 +55,47 @@ func (r *Relayer) CreateIBCChannel(override bool, logFileOption utils.CommandOpt
return ConnectionChannels{}, err
}

createChannelCmd := r.getCreateChannelCmd(override)
status = "Creating channel..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return ConnectionChannels{}, err
}
if err := utils.ExecBashCmd(createChannelCmd, logFileOption); err != nil {
return ConnectionChannels{}, err
}
status = "Waiting for channel finalization..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return ConnectionChannels{}, err
}
var src, dst string
err = retry.Do(
func() error {
var err error
src, dst, err = r.LoadChannels()
if err != nil {
createChannelCmd := r.getCreateChannelCmd(override)
status = "Creating channel..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return err
}
if src == "" || dst == "" {
return fmt.Errorf("could not load channels")
if err := utils.ExecBashCmd(createChannelCmd, logFileOption); err != nil {
return err
}
return nil
},
retry.Delay(time.Duration(10)*time.Second),
status = "Waiting for channel finalization..."
fmt.Printf("💈 %s\n", status)
if err := r.WriteRelayerStatus(status); err != nil {
return err
}

err = retry.Do(
func() error {
var err error
src, dst, err = r.LoadChannels()
if err != nil {
return err
}
if src == "" || dst == "" {
return fmt.Errorf("could not load channels")
}
return nil
},
retry.Delay(time.Duration(30)*time.Second),
retry.DelayType(retry.FixedDelay),
retry.Attempts(3),
retry.OnRetry(func(n uint, err error) {
r.logger.Printf("error validating clients created. attempt %d, error %s", n, err)
}),
)
return err
}, retry.Delay(time.Duration(30)*time.Second),
retry.DelayType(retry.FixedDelay),
retry.Attempts(5),
retry.OnRetry(func(n uint, err error) {
r.logger.Printf("error validating clients created. attempt %d, error %s", n, err)
}),
)
if err != nil {
return ConnectionChannels{}, err
Expand All @@ -112,7 +120,7 @@ func (r *Relayer) getCreateClientsCmd(override bool) *exec.Cmd {
}

func (r *Relayer) getCreateConnectionCmd(override bool) *exec.Cmd {
args := []string{"tx", "connection", "-t", "300s"}
args := []string{"tx", "connection", "-t", "30s", "-r", "20"}
if override {
args = append(args, "--override")
}
Expand All @@ -121,7 +129,7 @@ func (r *Relayer) getCreateConnectionCmd(override bool) *exec.Cmd {
}

func (r *Relayer) getCreateChannelCmd(override bool) *exec.Cmd {
args := []string{"tx", "channel", "-t", "300s"}
args := []string{"tx", "channel", "-t", "30s", "-r", "20"}
if override {
args = append(args, "--override")
}
Expand Down