Commit 671917cd authored by Joshua Gutow's avatar Joshua Gutow

op-service: Use IsURLAvailable

parent 8f406ae5
...@@ -53,11 +53,14 @@ func DialRollupClientWithTimeout(timeout time.Duration, log log.Logger, url stri ...@@ -53,11 +53,14 @@ func DialRollupClientWithTimeout(timeout time.Duration, log log.Logger, url stri
func dialRPCClientWithBackoff(ctx context.Context, log log.Logger, addr string) (*rpc.Client, error) { func dialRPCClientWithBackoff(ctx context.Context, log log.Logger, addr string) (*rpc.Client, error) {
bOff := backoff.Fixed(defaultRetryTime) bOff := backoff.Fixed(defaultRetryTime)
return backoff.Do(ctx, defaultRetryCount, bOff, func() (*rpc.Client, error) { return backoff.Do(ctx, defaultRetryCount, bOff, func() (*rpc.Client, error) {
if !IsURLAvailable(addr) {
log.Warn("failed to dial address, but may connect later", "addr", addr)
return nil, fmt.Errorf("address unavailable (%s)", addr)
}
client, err := rpc.DialOptions(ctx, addr) client, err := rpc.DialOptions(ctx, addr)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to dial address (%s): %w", addr, err) return nil, fmt.Errorf("failed to dial address (%s): %w", addr, err)
} }
// log.Warn("failed to dial address, but may connect later", "addr", addr, "err", err)
return client, nil return client, nil
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment