fix: s3 gateway DNS cache initialization (#10706)

fixes #10705
master
Harshavardhana 4 years ago committed by GitHub
parent ba5215561f
commit c107728676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cmd/common-main.go
  2. 5
      cmd/gateway-main.go
  3. 4
      cmd/server-main.go
  4. 1
      pkg/dsync/drwmutex.go

@ -21,6 +21,7 @@ import (
"encoding/gob"
"errors"
"fmt"
"math/rand"
"net"
"net/url"
"os"
@ -33,6 +34,7 @@ import (
"github.com/minio/cli"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/cmd/config"
xhttp "github.com/minio/minio/cmd/http"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/auth"
"github.com/minio/minio/pkg/certs"
@ -43,6 +45,9 @@ func init() {
logger.Init(GOPATH, GOROOT)
logger.RegisterError(config.FmtError)
rand.Seed(time.Now().UTC().UnixNano())
globalDNSCache = xhttp.NewDNSCache(3*time.Second, 10*time.Second)
gob.Register(StorageErr(""))
}

@ -19,14 +19,12 @@ package cmd
import (
"context"
"fmt"
"math/rand"
"net"
"net/url"
"os"
"os/signal"
"strings"
"syscall"
"time"
"github.com/gorilla/mux"
"github.com/minio/cli"
@ -155,9 +153,6 @@ func ValidateGatewayArguments(serverAddr, endpointAddr string) error {
// StartGateway - handler for 'minio gateway <name>'.
func StartGateway(ctx *cli.Context, gw Gateway) {
rand.Seed(time.Now().UTC().UnixNano())
globalDNSCache = xhttp.NewDNSCache(3*time.Second, 10*time.Second)
defer globalDNSCache.Stop()
// This is only to uniquely identify each gateway deployments.

@ -20,7 +20,6 @@ import (
"context"
"errors"
"fmt"
"math/rand"
"net"
"os"
"os/signal"
@ -362,9 +361,6 @@ func initAllSubsystems(ctx context.Context, newObject ObjectLayer) (err error) {
// serverMain handler called for 'minio server' command.
func serverMain(ctx *cli.Context) {
rand.Seed(time.Now().UTC().UnixNano())
globalDNSCache = xhttp.NewDNSCache(3*time.Second, 10*time.Second)
defer globalDNSCache.Stop()
signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT)

@ -33,7 +33,6 @@ var dsyncLog bool
func init() {
// Check for MINIO_DSYNC_TRACE env variable, if set logging will be enabled for failed REST operations.
dsyncLog = os.Getenv("MINIO_DSYNC_TRACE") == "1"
rand.Seed(time.Now().UnixNano())
}
func log(format string, data ...interface{}) {

Loading…
Cancel
Save