mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Enforce a minimum refresh interval for the HIBP module
This commit is contained in:
parent
8ce2242b52
commit
c75f00cb12
@ -9,8 +9,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
defaultTitle = "HIBP"
|
||||
minRefreshSecs = 21600 // TODO: Finish implementing this
|
||||
defaultTitle = "HIBP"
|
||||
minRefreshInterval = 21600 // Six hours
|
||||
)
|
||||
|
||||
type colors struct {
|
||||
@ -40,6 +40,12 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
||||
settings.colors.ok = ymlConfig.UString("colors.ok", "green")
|
||||
settings.colors.pwned = ymlConfig.UString("colors.pwned", "red")
|
||||
|
||||
// HIBP data doesn't need to be reloaded very often so to be gentle on this API we
|
||||
// enforce a minimum refresh interval
|
||||
if settings.common.RefreshInterval < minRefreshInterval {
|
||||
settings.common.RefreshInterval = minRefreshInterval
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user