diff options
| author | Max Denushev <mdenushev@ya.ru> | 2024-11-14 19:40:55 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-14 08:40:55 -0800 |
| commit | a5fe6e21bce464017fde036160e986d4c3bb81db (patch) | |
| tree | 4eee03e2651ab5cea1ad42d159e5220a43b6da2a /weed/util | |
| parent | 3003c9e17e06db92f5a426c191ebaab15a1764a1 (diff) | |
| download | seaweedfs-a5fe6e21bce464017fde036160e986d4c3bb81db.tar.xz seaweedfs-a5fe6e21bce464017fde036160e986d4c3bb81db.zip | |
feat(filer.backup): add ignore errors option (#6235)
* feat(filer.backup): add ignore errors option
* feat(filer.backup): fix 404 error wrap
* feat(filer.backup): fix wrapping function
* feat(filer.backup): fix wrapping errors in genProcessFunction
* Update weed/command/filer_backup.go
* Update weed/command/filer_backup.go
* Update weed/command/filer_backup.go
---------
Co-authored-by: Max Denushev <denushev@tochka.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Diffstat (limited to 'weed/util')
| -rw-r--r-- | weed/util/http/http_global_client_util.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/weed/util/http/http_global_client_util.go b/weed/util/http/http_global_client_util.go index c3931a790..33d978d9e 100644 --- a/weed/util/http/http_global_client_util.go +++ b/weed/util/http/http_global_client_util.go @@ -5,8 +5,8 @@ import ( "encoding/json" "errors" "fmt" - "github.com/seaweedfs/seaweedfs/weed/util/mem" "github.com/seaweedfs/seaweedfs/weed/util" + "github.com/seaweedfs/seaweedfs/weed/util/mem" "io" "net/http" "net/url" @@ -16,6 +16,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/glog" ) +var ErrNotFound = fmt.Errorf("not found") + func Post(url string, values url.Values) ([]byte, error) { r, err := GetGlobalHttpClient().PostForm(url, values) if err != nil { @@ -311,7 +313,10 @@ func ReadUrlAsStreamAuthenticated(fileUrl, jwt string, cipherKey []byte, isConte } defer CloseResponse(r) if r.StatusCode >= 400 { - retryable = r.StatusCode == http.StatusNotFound || r.StatusCode >= 499 + if r.StatusCode == http.StatusNotFound { + return true, fmt.Errorf("%s: %s: %w", fileUrl, r.Status, ErrNotFound) + } + retryable = r.StatusCode >= 499 return retryable, fmt.Errorf("%s: %s", fileUrl, r.Status) } @@ -477,4 +482,4 @@ func RetriedFetchChunkData(buffer []byte, urlStrings []string, cipherKey []byte, return n, err -}
\ No newline at end of file +} |
