mirror of https://github.com/minio/minio.git
allow DNS cache TTL to be configurable (#17709)
this is added for now as a hidden variable
This commit is contained in:
parent
14e1ace552
commit
c32c71c836
|
@ -102,22 +102,6 @@ func init() {
|
|||
|
||||
globalIsCICD = env.Get("MINIO_CI_CD", "") != "" || env.Get("CI", "") != ""
|
||||
|
||||
// Call to refresh will refresh names in cache.
|
||||
go func() {
|
||||
// Baremetal setups set DNS refresh window to 10 minutes.
|
||||
t := time.NewTicker(10 * time.Minute)
|
||||
defer t.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-t.C:
|
||||
globalDNSCache.Refresh()
|
||||
|
||||
case <-GlobalContext.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
console.SetColor("Debug", fcolor.New())
|
||||
|
||||
gob.Register(StorageErr(""))
|
||||
|
@ -443,6 +427,28 @@ func handleCommonCmdArgs(ctx *cli.Context) {
|
|||
globalCertsCADir = &ConfigDir{path: filepath.Join(globalCertsDir.Get(), certsCADir)}
|
||||
|
||||
logger.FatalIf(mkdirAllIgnorePerm(globalCertsCADir.Get()), "Unable to create certs CA directory at %s", globalCertsCADir.Get())
|
||||
|
||||
// Check if we have configured a custom DNS cache TTL.
|
||||
dnsTTL := ctx.Duration("dns-cache-ttl")
|
||||
if dnsTTL <= 0 {
|
||||
dnsTTL = 10 * time.Minute
|
||||
}
|
||||
|
||||
// Call to refresh will refresh names in cache.
|
||||
go func() {
|
||||
// Baremetal setups set DNS refresh window up to dnsTTL duration.
|
||||
t := time.NewTicker(dnsTTL)
|
||||
defer t.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-t.C:
|
||||
globalDNSCache.Refresh()
|
||||
|
||||
case <-GlobalContext.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
type envKV struct {
|
||||
|
|
|
@ -121,6 +121,13 @@ var ServerFlags = []cli.Flag{
|
|||
Hidden: true,
|
||||
EnvVar: "MINIO_INTERFACE",
|
||||
},
|
||||
cli.DurationFlag{
|
||||
Name: "dns-cache-ttl",
|
||||
Usage: "custom DNS cache TTL for baremetal setups",
|
||||
Hidden: true,
|
||||
Value: 10 * time.Minute,
|
||||
EnvVar: "MINIO_DNS_CACHE_TTL",
|
||||
},
|
||||
cli.StringSliceFlag{
|
||||
Name: "ftp",
|
||||
Usage: "enable and configure an FTP(Secure) server",
|
||||
|
|
Loading…
Reference in New Issue