0.3.49
This commit is contained in:
@@ -163,6 +163,31 @@ func (s *Server) LibrarySyncInterval() time.Duration {
|
||||
s.cfg.SyncInterval)
|
||||
}
|
||||
|
||||
// homeTTL and recommendTTL are "the override, or what was deployed" for the two cache
|
||||
// lifetimes an operator can reach. They cannot be switched off, so a non-positive stored
|
||||
// value falls through to the deployed duration.
|
||||
func (s *Server) homeTTL() time.Duration {
|
||||
if seconds := s.gatewaySettings.get().HomeTTLSeconds; seconds > 0 {
|
||||
return time.Duration(seconds) * time.Second
|
||||
}
|
||||
return s.cfg.HomeTTL
|
||||
}
|
||||
|
||||
func (s *Server) recommendTTL() time.Duration {
|
||||
if hours := s.gatewaySettings.get().RecommendTTLHours; hours > 0 {
|
||||
return time.Duration(hours) * time.Hour
|
||||
}
|
||||
return s.cfg.RecommendTTL
|
||||
}
|
||||
|
||||
// forYouRebuildHour is the household-local hour the daily For You rebuild is due at.
|
||||
func (s *Server) forYouRebuildHour() int {
|
||||
if hour := s.gatewaySettings.get().ForYouRebuildHour; hour != nil {
|
||||
return *hour
|
||||
}
|
||||
return s.cfg.ForYouRebuildHour
|
||||
}
|
||||
|
||||
// overrideWindow reads one of the three settings that can be switched off: a negative
|
||||
// value is off, zero is "whatever was deployed", anything else is the override in the
|
||||
// given unit.
|
||||
@@ -191,6 +216,9 @@ type deployedGatewaySettings struct {
|
||||
EmbyHealthSeconds int `json:"embyHealthSeconds"`
|
||||
SlowRequestMillis int `json:"slowRequestMillis"`
|
||||
LibrarySyncMinutes int `json:"librarySyncMinutes"`
|
||||
HomeTTLSeconds int `json:"homeTtlSeconds"`
|
||||
RecommendTTLHours int `json:"recommendTtlHours"`
|
||||
ForYouRebuildHour int `json:"forYouRebuildHour"`
|
||||
}
|
||||
|
||||
func (s *Server) deployedSettings() deployedGatewaySettings {
|
||||
@@ -208,6 +236,9 @@ func (s *Server) deployedSettings() deployedGatewaySettings {
|
||||
EmbyHealthSeconds: int(s.cfg.EmbyHealthInterval / time.Second),
|
||||
SlowRequestMillis: int(s.cfg.SlowRequestThreshold / time.Millisecond),
|
||||
LibrarySyncMinutes: int(s.cfg.SyncInterval / time.Minute),
|
||||
HomeTTLSeconds: int(s.cfg.HomeTTL / time.Second),
|
||||
RecommendTTLHours: int(s.cfg.RecommendTTL / time.Hour),
|
||||
ForYouRebuildHour: s.cfg.ForYouRebuildHour,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user