style: format code with gofmt
This commit is contained in:
@@ -275,17 +275,17 @@ func (cm *ConnectionManager) getFallbackEndpoints() []string {
|
||||
// Default fallbacks if none configured - enhanced list from providers_runtime.yaml
|
||||
if len(endpoints) == 0 {
|
||||
endpoints = []string{
|
||||
"https://arb1.arbitrum.io/rpc", // Official Arbitrum
|
||||
"https://arbitrum-one.publicnode.com", // PublicNode
|
||||
"https://arbitrum-one.public.blastapi.io", // BlastAPI
|
||||
"https://1rpc.io/42161", // 1RPC
|
||||
"https://rpc.arb1.arbitrum.gateway.fm", // Gateway FM
|
||||
"https://arb-mainnet-public.unifra.io", // Unifra
|
||||
"https://arbitrum.blockpi.network/v1/rpc/public", // BlockPI
|
||||
"https://arbitrum.llamarpc.com", // LlamaNodes
|
||||
"wss://arbitrum-one.publicnode.com", // PublicNode WebSocket
|
||||
"https://arbitrum-one-rpc.publicnode.com", // PublicNode Alternative
|
||||
"https://arb-mainnet.g.alchemy.com/v2/demo", // Alchemy demo
|
||||
"https://arb1.arbitrum.io/rpc", // Official Arbitrum
|
||||
"https://arbitrum-one.publicnode.com", // PublicNode
|
||||
"https://arbitrum-one.public.blastapi.io", // BlastAPI
|
||||
"https://1rpc.io/42161", // 1RPC
|
||||
"https://rpc.arb1.arbitrum.gateway.fm", // Gateway FM
|
||||
"https://arb-mainnet-public.unifra.io", // Unifra
|
||||
"https://arbitrum.blockpi.network/v1/rpc/public", // BlockPI
|
||||
"https://arbitrum.llamarpc.com", // LlamaNodes
|
||||
"wss://arbitrum-one.publicnode.com", // PublicNode WebSocket
|
||||
"https://arbitrum-one-rpc.publicnode.com", // PublicNode Alternative
|
||||
"https://arb-mainnet.g.alchemy.com/v2/demo", // Alchemy demo
|
||||
}
|
||||
cm.logger.Info(fmt.Sprintf("📋 Using %d default RPC endpoints for failover", len(endpoints)))
|
||||
}
|
||||
|
||||
@@ -54,11 +54,11 @@ func (r *RateLimitedRPC) CallWithRetry(ctx context.Context, method string, args
|
||||
case <-ctx.Done():
|
||||
return nil, pkgerrors.WrapContextError(ctx.Err(), "RateLimitedRPC.CallWithRetry.rateLimitBackoff",
|
||||
map[string]interface{}{
|
||||
"method": method,
|
||||
"attempt": i + 1,
|
||||
"maxRetries": r.retryCount,
|
||||
"backoffTime": backoffTime.String(),
|
||||
"lastError": err.Error(),
|
||||
"method": method,
|
||||
"attempt": i + 1,
|
||||
"maxRetries": r.retryCount,
|
||||
"backoffTime": backoffTime.String(),
|
||||
"lastError": err.Error(),
|
||||
})
|
||||
case <-time.After(backoffTime):
|
||||
// Continue to next retry
|
||||
|
||||
@@ -12,11 +12,11 @@ import (
|
||||
|
||||
// RoundRobinClient wraps a client and tracks round-robin usage
|
||||
type RoundRobinClient struct {
|
||||
manager *RPCManager
|
||||
ctx context.Context
|
||||
logger *logger.Logger
|
||||
lastIdx int
|
||||
readCalls int64
|
||||
manager *RPCManager
|
||||
ctx context.Context
|
||||
logger *logger.Logger
|
||||
lastIdx int
|
||||
readCalls int64
|
||||
writeCalls int64
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ type RPCManager struct {
|
||||
type RotationPolicy string
|
||||
|
||||
const (
|
||||
RoundRobin RotationPolicy = "round-robin"
|
||||
HealthAware RotationPolicy = "health-aware"
|
||||
LeastFailures RotationPolicy = "least-failures"
|
||||
RoundRobin RotationPolicy = "round-robin"
|
||||
HealthAware RotationPolicy = "health-aware"
|
||||
LeastFailures RotationPolicy = "least-failures"
|
||||
)
|
||||
|
||||
// NewRPCManager creates a new RPC manager with multiple endpoints
|
||||
@@ -218,14 +218,14 @@ func (rm *RPCManager) GetAllHealthStats() []map[string]interface{} {
|
||||
for i, h := range rm.health {
|
||||
success, failure, consecutive, healthy := h.GetStats()
|
||||
stats = append(stats, map[string]interface{}{
|
||||
"index": i,
|
||||
"url": h.URL,
|
||||
"success_count": success,
|
||||
"failure_count": failure,
|
||||
"consecutive_fails": consecutive,
|
||||
"is_healthy": healthy,
|
||||
"last_checked": h.LastChecked,
|
||||
"response_time_ms": h.ResponseTime.Milliseconds(),
|
||||
"index": i,
|
||||
"url": h.URL,
|
||||
"success_count": success,
|
||||
"failure_count": failure,
|
||||
"consecutive_fails": consecutive,
|
||||
"is_healthy": healthy,
|
||||
"last_checked": h.LastChecked,
|
||||
"response_time_ms": h.ResponseTime.Milliseconds(),
|
||||
})
|
||||
}
|
||||
return stats
|
||||
@@ -292,8 +292,8 @@ func (rm *RPCManager) healthCheckEndpoint(ctx context.Context, index int, client
|
||||
rm.RecordFailure(index)
|
||||
return pkgerrors.WrapContextError(err, "RPCManager.healthCheckEndpoint",
|
||||
map[string]interface{}{
|
||||
"endpoint_index": index,
|
||||
"response_time": responseTime.String(),
|
||||
"endpoint_index": index,
|
||||
"response_time": responseTime.String(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user