Skip to content

Commit 5dbe0a5

Browse files
committed
fix
1 parent 8884ad8 commit 5dbe0a5

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

rpc.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ func (m *Monitor) buildConnection(ipcPath, rpcURI string) (*rpc.Client, error) {
3535
log.Debug("Building connection", "terminated", m.terminated.Load())
3636

3737
if ipcPath == "" && rpcURI == "" {
38-
err := errors.New("both ipcPath and rpcURI are empty — cannot build connection")
39-
log.Error("Invalid connection parameters", "error", err)
40-
return nil, err
38+
return nil, errors.New("both ipcPath and rpcURI are empty — cannot build connection")
4139
}
4240

4341
const maxRetries = 30
@@ -53,31 +51,24 @@ func (m *Monitor) buildConnection(ipcPath, rpcURI string) (*rpc.Client, error) {
5351
cl, err := rpc.Dial(ipcPath)
5452
if err == nil {
5553
m.local = true
56-
log.Info("Internal IPC connection established",
57-
"ipc", ipcPath, "rpc", rpcURI, "local", m.local)
54+
log.Info("Internal IPC connection established", "ipc", ipcPath, "rpc", rpcURI, "local", m.local)
5855
return cl, nil
5956
}
6057

61-
log.Warn("Retrying IPC connection...",
62-
"attempt", i+1, "max", maxRetries,
63-
"ipc", ipcPath, "rpc", rpcURI,
64-
"error", err)
58+
log.Warn("Retrying IPC connection...", "attempt", i+1, "max", maxRetries, "ipc", ipcPath, "rpc", rpcURI, "error", err)
6559
time.Sleep(retryInterval)
6660
}
67-
log.Warn("IPC connection attempts exhausted, fallback to RPC",
68-
"ipc", ipcPath, "rpc", rpcURI)
61+
log.Warn("IPC connection attempts exhausted, fallback to RPC", "ipc", ipcPath, "rpc", rpcURI)
6962
}
7063

7164
if rpcURI != "" {
7265
cl, err := rpc.Dial(rpcURI)
7366
if err == nil {
74-
log.Info("Internal RPC connection established",
75-
"ipc", ipcPath, "rpc", rpcURI, "local", m.local)
67+
log.Info("Internal RPC connection established", "ipc", ipcPath, "rpc", rpcURI, "local", m.local)
7668
return cl, nil
7769
}
7870

79-
log.Error("Failed to build RPC connection",
80-
"ipc", ipcPath, "rpc", rpcURI, "error", err)
71+
log.Error("Failed to build RPC connection", "ipc", ipcPath, "rpc", rpcURI, "error", err)
8172
return nil, fmt.Errorf("failed to establish rpc connection: %w", err)
8273
}
8374

0 commit comments

Comments
 (0)