mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-07 00:37:36 +00:00
24 lines
745 B
Go
24 lines
745 B
Go
package monitoring
|
|
|
|
import "strings"
|
|
|
|
// shouldPreservePBSBackupsWithTerminal preserves stale PBS backups only when all
|
|
// datastore fetches failed and at least one failure was non-terminal.
|
|
func shouldPreservePBSBackupsWithTerminal(datastoreCount, datastoreFetches, datastoreTerminalFailure int) bool {
|
|
if datastoreCount > 0 && datastoreFetches == 0 && datastoreTerminalFailure < datastoreCount {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
// shouldReuseCachedPBSBackups keeps cached data for transient fetch errors and
|
|
// avoids reuse for terminal API 4xx errors.
|
|
func shouldReuseCachedPBSBackups(err error) bool {
|
|
if err == nil {
|
|
return false
|
|
}
|
|
if strings.Contains(strings.ToLower(err.Error()), "api error 4") {
|
|
return false
|
|
}
|
|
return true
|
|
}
|