diff --git a/api.go b/api.go index 08523b4f9..79c6573ee 100644 --- a/api.go +++ b/api.go @@ -1061,12 +1061,12 @@ func (api *API) calculateUsage() { } // Periodically calculates disk usage -func (api *API) RefreshUsageCache(refresh time.Duration) { +func (api *API) RefreshUsageCache() { trigger := make(chan bool) defer close(trigger) api.usageCache = &usageCache{ data: make(map[string]NodeUsage), - refreshInterval: refresh, + refreshInterval: time.Hour, resetTrigger: trigger, lastCalcDuration: 0, waitMultiplier: time.Duration(5), diff --git a/ctl/server.go b/ctl/server.go index 250902fd1..6c885d213 100644 --- a/ctl/server.go +++ b/ctl/server.go @@ -110,7 +110,4 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) { flags.DurationVar((*time.Duration)(&srv.Config.Postgres.WriteTimeout), "postgres.write-timeout", time.Duration(srv.Config.Postgres.WriteTimeout), "Timeout for writes on a postgres connection. (set 0 to disable)") flags.Uint32Var(&srv.Config.Postgres.MaxStartupSize, "postgres.max-startup-size", srv.Config.Postgres.MaxStartupSize, "Maximum acceptable size of a postgres startup packet, in bytes. (set 0 to disable)") flags.Uint16Var(&srv.Config.Postgres.ConnectionLimit, "postgres.connection-limit", srv.Config.Postgres.ConnectionLimit, "Maximum number of simultaneous postgres connections to allow. (set 0 to disable)") - - // Disk/Memory Usage refresh rate in minutes for ui/usage http endpoint - flags.DurationVar((*time.Duration)(&srv.Config.Usage.Interval), "usage-interval", time.Duration(srv.Config.Usage.Interval), "Number in minutes between recalculations of disk/memory usage cache") } diff --git a/server/config.go b/server/config.go index 7871364db..f59040271 100644 --- a/server/config.go +++ b/server/config.go @@ -224,11 +224,6 @@ type Config struct { // LookupDBDSN is an external database to connect to for `ExternalLookup` queries. LookupDBDSN string `toml:"lookup-db-dsn"` - - // Disk Usage refresh interval for ui/usage http endpoint - Usage struct { - Interval toml.Duration `toml:"usage-interval"` - } } // MustValidate checks that all ports in a Config are unique and not zero. @@ -364,8 +359,6 @@ func NewConfig() *Config { c.Etcd.PeerCertFile = "" c.Etcd.PeerKeyFile = "" - c.Usage.Interval = toml.Duration(6 * 60 * time.Minute) // 6 hours - return c } diff --git a/server/server.go b/server/server.go index a8d5ecfc4..febdb13ee 100644 --- a/server/server.go +++ b/server/server.go @@ -277,7 +277,7 @@ func (m *Command) Start() (err error) { } } - go m.API.RefreshUsageCache(time.Duration(m.Config.Usage.Interval)) + go m.API.RefreshUsageCache() _ = testhook.Opened(pilosa.NewAuditor(), m, nil) close(m.Started)