From a0df7ab9212acbc4cb95c235a8518df652ce36f6 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Sat, 17 Oct 2015 14:14:20 +0200 Subject: [PATCH] Rename BackendsThrottleDuration to ProvidersThrottleDuration Signed-off-by: Vincent Demeester --- configuration.go | 32 ++++++++++++++++---------------- docs/index.md | 2 +- traefik.go | 11 +++++------ traefik.sample.toml | 2 +- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/configuration.go b/configuration.go index efdfef429..8507ab4c9 100644 --- a/configuration.go +++ b/configuration.go @@ -7,21 +7,21 @@ import ( ) type GlobalConfiguration struct { - Port string - GraceTimeOut int64 - AccessLogsFile string - TraefikLogsFile string - CertFile, KeyFile string - LogLevel string - BackendsThrottleDuration time.Duration - Docker *DockerProvider - File *FileProvider - Web *WebProvider - Marathon *MarathonProvider - Consul *ConsulProvider - Etcd *EtcdProvider - Zookeeper *ZookepperProvider - Boltdb *BoltDbProvider + Port string + GraceTimeOut int64 + AccessLogsFile string + TraefikLogsFile string + CertFile, KeyFile string + LogLevel string + ProvidersThrottleDuration time.Duration + Docker *DockerProvider + File *FileProvider + Web *WebProvider + Marathon *MarathonProvider + Consul *ConsulProvider + Etcd *EtcdProvider + Zookeeper *ZookepperProvider + Boltdb *BoltDbProvider } func NewGlobalConfiguration() *GlobalConfiguration { @@ -30,7 +30,7 @@ func NewGlobalConfiguration() *GlobalConfiguration { globalConfiguration.Port = ":80" globalConfiguration.GraceTimeOut = 10 globalConfiguration.LogLevel = "ERROR" - globalConfiguration.BackendsThrottleDuration = time.Duration(2 * time.Second) + globalConfiguration.ProvidersThrottleDuration = time.Duration(2 * time.Second) return globalConfiguration } diff --git a/docs/index.md b/docs/index.md index 5644af607..ffdd05d7b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -115,7 +115,7 @@ For example: # Optional # Default: "2s" # -# BackendsThrottleDuration = "5s" +# ProvidersThrottleDuration = "5s" ``` diff --git a/traefik.go b/traefik.go index 4a3464f30..dd6139353 100644 --- a/traefik.go +++ b/traefik.go @@ -104,15 +104,15 @@ func main() { configMsg := <-configurationChan log.Infof("Configuration receveived from provider %s: %#v", configMsg.providerName, configMsg.configuration) lastConfigs[configMsg.providerName] = &configMsg - if time.Now().After(lastReceivedConfiguration.Add(time.Duration(globalConfiguration.BackendsThrottleDuration))) { - log.Infof("Last %s config received more than %s, OK", configMsg.providerName, globalConfiguration.BackendsThrottleDuration) + if time.Now().After(lastReceivedConfiguration.Add(time.Duration(globalConfiguration.ProvidersThrottleDuration))) { + log.Infof("Last %s config received more than %s, OK", configMsg.providerName, globalConfiguration.ProvidersThrottleDuration) // last config received more than n s ago configurationChanValidated <- configMsg } else { - log.Infof("Last %s config received less than %s, waiting...", configMsg.providerName, globalConfiguration.BackendsThrottleDuration) + log.Infof("Last %s config received less than %s, waiting...", configMsg.providerName, globalConfiguration.ProvidersThrottleDuration) go func() { - <-time.After(globalConfiguration.BackendsThrottleDuration) - if time.Now().After(lastReceivedConfiguration.Add(time.Duration(globalConfiguration.BackendsThrottleDuration))) { + <-time.After(globalConfiguration.ProvidersThrottleDuration) + if time.Now().After(lastReceivedConfiguration.Add(time.Duration(globalConfiguration.ProvidersThrottleDuration))) { log.Infof("Waited for %s config, OK", configMsg.providerName) configurationChanValidated <- *lastConfigs[configMsg.providerName] } @@ -124,7 +124,6 @@ func main() { go func() { for { configMsg := <-configurationChanValidated - log.Debugf("Configuration %s", spew.Sdump(configMsg.configuration)) if configMsg.configuration == nil { log.Info("Skipping empty configuration") } else if reflect.DeepEqual(currentConfigurations[configMsg.providerName], configMsg.configuration) { diff --git a/traefik.sample.toml b/traefik.sample.toml index 9d824343c..d07b2fbc2 100644 --- a/traefik.sample.toml +++ b/traefik.sample.toml @@ -51,7 +51,7 @@ # Optional # Default: "2s" # -# BackendsThrottleDuration = "5s" +# ProvidersThrottleDuration = "5s" ################################################################