Add support for running hishtory redact while offline, even though this may lead to syncing inconsistency bugs

This commit is contained in:
David Dworken
2023-10-22 11:43:56 -07:00
parent c613e696b4
commit 2b1af986d8
3 changed files with 22 additions and 10 deletions

View File

@ -569,7 +569,7 @@ func IsOfflineError(ctx context.Context, err error) bool {
strings.Contains(err.Error(), "connect: connection refused") {
return true
}
if !isHishtoryServerUp(ctx) {
if !CanReachHishtoryServer(ctx) {
// If the backend server is down, then treat all errors as offline errors
return true
}
@ -577,7 +577,7 @@ func IsOfflineError(ctx context.Context, err error) bool {
return false
}
func isHishtoryServerUp(ctx context.Context) bool {
func CanReachHishtoryServer(ctx context.Context) bool {
_, err := ApiGet(ctx, "/api/v1/ping")
return err == nil
}