From df60b3c733ee6117148ef7ffdac45f880fa68b5e Mon Sep 17 00:00:00 2001 From: Pontus Leitzler Date: Sat, 22 Sep 2018 01:04:11 +0200 Subject: [PATCH] Remove unnecessary contexts passed as data to FatalIf. No need to log an empty context. (#6487) --- cmd/admin-rpc-client.go | 4 ++-- cmd/admin-rpc-server.go | 3 +-- cmd/generic-handlers.go | 2 +- cmd/lock-rpc-server.go | 2 +- cmd/namespace-lock.go | 4 ++-- cmd/peer-rpc-client.go | 4 ++-- cmd/peer-rpc-server.go | 2 +- cmd/storage-rpc-client.go | 5 ++--- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/cmd/admin-rpc-client.go b/cmd/admin-rpc-client.go index 0e1a3afc8..c8bef0025 100644 --- a/cmd/admin-rpc-client.go +++ b/cmd/admin-rpc-client.go @@ -157,9 +157,9 @@ func makeAdminPeers(endpoints EndpointList) (adminPeerList adminPeers) { for _, hostStr := range GetRemotePeers(endpoints) { host, err := xnet.ParseHost(hostStr) - logger.FatalIf(err, "Unable to parse Admin RPC Host", context.Background()) + logger.FatalIf(err, "Unable to parse Admin RPC Host") rpcClient, err := NewAdminRPCClient(host) - logger.FatalIf(err, "Unable to initialize Admin RPC Client", context.Background()) + logger.FatalIf(err, "Unable to initialize Admin RPC Client") adminPeerList = append(adminPeerList, adminPeer{ addr: hostStr, cmdRunner: rpcClient, diff --git a/cmd/admin-rpc-server.go b/cmd/admin-rpc-server.go index 241752c95..a71f51ea6 100644 --- a/cmd/admin-rpc-server.go +++ b/cmd/admin-rpc-server.go @@ -17,7 +17,6 @@ package cmd import ( - "context" "path" "github.com/gorilla/mux" @@ -98,7 +97,7 @@ func NewAdminRPCServer() (*xrpc.Server, error) { // registerAdminRPCRouter - creates and registers Admin RPC server and its router. func registerAdminRPCRouter(router *mux.Router) { rpcServer, err := NewAdminRPCServer() - logger.FatalIf(err, "Unable to initialize Lock RPC Server", context.Background()) + logger.FatalIf(err, "Unable to initialize Lock RPC Server") subrouter := router.PathPrefix(minioReservedBucketPath).Subrouter() subrouter.Path(adminServiceSubPath).HandlerFunc(httpTraceHdrs(rpcServer.ServeHTTP)) } diff --git a/cmd/generic-handlers.go b/cmd/generic-handlers.go index ef02892f0..1498e33a7 100644 --- a/cmd/generic-handlers.go +++ b/cmd/generic-handlers.go @@ -689,7 +689,7 @@ func setBucketForwardingHandler(h http.Handler) http.Handler { // canceled immediately. func setRateLimitHandler(h http.Handler) http.Handler { _, maxLimit, err := sys.GetMaxOpenFileLimit() - logger.FatalIf(err, "Unable to get maximum open file limit", context.Background()) + logger.FatalIf(err, "Unable to get maximum open file limit") // Burst value is set to 1 to allow only maxOpenFileLimit // requests to happen at once. l := rate.NewLimiter(rate.Limit(maxLimit), 1) diff --git a/cmd/lock-rpc-server.go b/cmd/lock-rpc-server.go index 29d7b0de4..3bd40bb40 100644 --- a/cmd/lock-rpc-server.go +++ b/cmd/lock-rpc-server.go @@ -186,7 +186,7 @@ func NewLockRPCServer() (*xrpc.Server, error) { // Register distributed NS lock handlers. func registerDistNSLockRouter(router *mux.Router) { rpcServer, err := NewLockRPCServer() - logger.FatalIf(err, "Unable to initialize Lock RPC Server", context.Background()) + logger.FatalIf(err, "Unable to initialize Lock RPC Server") // Start lock maintenance from all lock servers. go startLockMaintenance(globalLockServer) diff --git a/cmd/namespace-lock.go b/cmd/namespace-lock.go index d4d0eebb4..ebacada3b 100644 --- a/cmd/namespace-lock.go +++ b/cmd/namespace-lock.go @@ -86,9 +86,9 @@ func newDsyncNodes(endpoints EndpointList) (clnts []dsync.NetLocker, myNode int) locker = &(receiver.ll) } else { host, err := xnet.ParseHost(endpoint.Host) - logger.FatalIf(err, "Unable to parse Lock RPC Host", context.Background()) + logger.FatalIf(err, "Unable to parse Lock RPC Host") locker, err = NewLockRPCClient(host) - logger.FatalIf(err, "Unable to initialize Lock RPC Client", context.Background()) + logger.FatalIf(err, "Unable to initialize Lock RPC Client") } clnts = append(clnts, locker) diff --git a/cmd/peer-rpc-client.go b/cmd/peer-rpc-client.go index fceafb58a..9893c773f 100644 --- a/cmd/peer-rpc-client.go +++ b/cmd/peer-rpc-client.go @@ -165,9 +165,9 @@ func makeRemoteRPCClients(endpoints EndpointList) map[xnet.Host]*PeerRPCClient { peerRPCClientMap := make(map[xnet.Host]*PeerRPCClient) for _, hostStr := range GetRemotePeers(endpoints) { host, err := xnet.ParseHost(hostStr) - logger.FatalIf(err, "Unable to parse peer RPC Host", context.Background()) + logger.FatalIf(err, "Unable to parse peer RPC Host") rpcClient, err := NewPeerRPCClient(host) - logger.FatalIf(err, "Unable to parse peer RPC Client", context.Background()) + logger.FatalIf(err, "Unable to parse peer RPC Client") peerRPCClientMap[*host] = rpcClient } diff --git a/cmd/peer-rpc-server.go b/cmd/peer-rpc-server.go index 8929a5eb2..ebabcd275 100644 --- a/cmd/peer-rpc-server.go +++ b/cmd/peer-rpc-server.go @@ -226,7 +226,7 @@ func NewPeerRPCServer() (*xrpc.Server, error) { // registerPeerRPCRouter - creates and registers Peer RPC server and its router. func registerPeerRPCRouter(router *mux.Router) { rpcServer, err := NewPeerRPCServer() - logger.FatalIf(err, "Unable to initialize peer RPC Server", context.Background()) + logger.FatalIf(err, "Unable to initialize peer RPC Server") subrouter := router.PathPrefix(minioReservedBucketPath).Subrouter() subrouter.Path(peerServiceSubPath).HandlerFunc(httpTraceHdrs(rpcServer.ServeHTTP)) } diff --git a/cmd/storage-rpc-client.go b/cmd/storage-rpc-client.go index cece042c5..16076ca6d 100644 --- a/cmd/storage-rpc-client.go +++ b/cmd/storage-rpc-client.go @@ -18,7 +18,6 @@ package cmd import ( "bytes" - "context" "crypto/tls" "io" "net" @@ -330,9 +329,9 @@ func NewStorageRPCClient(host *xnet.Host, endpointPath string) (*StorageRPCClien // Initialize new storage rpc client. func newStorageRPC(endpoint Endpoint) *StorageRPCClient { host, err := xnet.ParseHost(endpoint.Host) - logger.FatalIf(err, "Unable to parse storage RPC Host", context.Background()) + logger.FatalIf(err, "Unable to parse storage RPC Host") rpcClient, err := NewStorageRPCClient(host, endpoint.Path) - logger.FatalIf(err, "Unable to initialize storage RPC client", context.Background()) + logger.FatalIf(err, "Unable to initialize storage RPC client") // Attempt first try connection and save error if any. rpcClient.connect() return rpcClient