remove usage-interval flag

This commit is contained in:
Samir Patel 2021-06-11 11:16:32 -05:00
parent 268e710e69
commit b46b5fc134
4 changed files with 3 additions and 13 deletions

4
api.go
View file

@ -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),

View file

@ -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")
}

View file

@ -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
}

View file

@ -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)