Allow usage-duty-cycle < 20%, and 0 disables

This commit is contained in:
Alan Bernstein 2021-07-02 11:31:37 -05:00
parent 153dea6e1d
commit b7898b0a22
2 changed files with 3 additions and 4 deletions

3
api.go
View file

@ -1067,9 +1067,6 @@ func (api *API) RefreshUsageCache(dutyCycle float64) {
trigger := make(chan bool)
defer close(trigger)
if dutyCycle <= 0 {
dutyCycle = 20
}
multiplier := 100/dutyCycle - 1
api.usageCache = &usageCache{

View file

@ -277,7 +277,9 @@ func (m *Command) Start() (err error) {
}
}
go m.API.RefreshUsageCache(m.Config.UsageDutyCycle)
if m.Config.UsageDutyCycle > 0 {
go m.API.RefreshUsageCache(m.Config.UsageDutyCycle)
}
_ = testhook.Opened(pilosa.NewAuditor(), m, nil)
close(m.Started)