0.2.79 - Slow api fixes
This commit is contained in:
@@ -40,12 +40,24 @@ func (s *Server) gatewaySettingsResponse() adminGatewaySettingsResponse {
|
||||
SonarrAlertMinutes: int(s.sonarrAlertWindow() / time.Minute),
|
||||
RadarrAlertMinutes: int(s.radarrAlertWindow() / time.Minute),
|
||||
EmbyHealthSeconds: int(s.embyHealthInterval() / time.Second),
|
||||
SlowRequestMillis: effectiveSlowRequestMillis(s.slowRequestThreshold()),
|
||||
LibrarySyncMinutes: int(s.LibrarySyncInterval() / time.Minute),
|
||||
},
|
||||
LogLevels: store.GatewayLogLevels,
|
||||
Version: buildinfo.Version(),
|
||||
}
|
||||
}
|
||||
|
||||
// effectiveSlowRequestMillis reports the switched-off threshold as zero rather than as
|
||||
// the impossible duration the reader uses, because the console draws the effective value
|
||||
// beside the field an operator cleared and "0" is what its own vocabulary means by off.
|
||||
func effectiveSlowRequestMillis(threshold time.Duration) int {
|
||||
if threshold <= 0 || threshold > time.Hour {
|
||||
return 0
|
||||
}
|
||||
return int(threshold / time.Millisecond)
|
||||
}
|
||||
|
||||
func (s *Server) effectiveLogLevel() string {
|
||||
if s.logLevel != nil {
|
||||
return levelName(s.logLevel.Level())
|
||||
@@ -121,6 +133,12 @@ func gatewaySettingsChanges(before, after store.GatewaySettings) string {
|
||||
if before.EmbyHealthSeconds != after.EmbyHealthSeconds {
|
||||
changes = append(changes, "Emby health probe")
|
||||
}
|
||||
if before.SlowRequestMillis != after.SlowRequestMillis {
|
||||
changes = append(changes, "slow-request threshold")
|
||||
}
|
||||
if before.LibrarySyncMinutes != after.LibrarySyncMinutes {
|
||||
changes = append(changes, "library sweep interval")
|
||||
}
|
||||
switch len(changes) {
|
||||
case 0:
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user