Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate PR #78 from old osdf-client #144

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ jobs:
set -x
cc_base_total=`grep total ./unit-base.txt | grep -Eo '[0-9]+\.[0-9]+'`
echo "cc_base_total=$cc_base_total" >> $GITHUB_OUTPUT
- name: Add Coverage to PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest'
with:
message: |
Current code coverage from unit tests: ${{steps.cc.outputs.cc_total}}% Prev: ${{steps.cc_b.outputs.cc_base_total}}%
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion cmd/object_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func copyMain(cmd *cobra.Command, args []string) {
if errMsg == "" {
errMsg = result.Error()
}
log.Errorln("Failure downloading " + lastSrc + ": " + errMsg)
log.Errorln("Failure transferring " + lastSrc + ": " + errMsg)
if pelican.ErrorsRetryable() {
log.Errorln("Errors are retryable")
os.Exit(11)
Expand Down
12 changes: 12 additions & 0 deletions errorAccum.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ func IsRetryable(err error) bool {
}
return true
}
var hep *HttpErrResp
if errors.As(err, &hep) {
switch int(hep.Code) {
case http.StatusInternalServerError:
case http.StatusBadGateway:
case http.StatusServiceUnavailable:
case http.StatusGatewayTimeout:
return true
default:
return false
}
}
return false
}

Expand Down
6 changes: 4 additions & 2 deletions handle_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,8 @@ Loop:
// prior attempt.
if resp.HTTPResponse.StatusCode != 200 && resp.HTTPResponse.StatusCode != 206 {
log.Debugln("Got failure status code:", resp.HTTPResponse.StatusCode)
return 0, errors.New("failure status code")
return 0, &HttpErrResp{resp.HTTPResponse.StatusCode, fmt.Sprintf("Request failed (HTTP status %d): %s",
resp.HTTPResponse.StatusCode, resp.Err().Error())}
}
log.Debugln("HTTP Transfer was successful")
return resp.BytesComplete(), nil
Expand Down Expand Up @@ -808,7 +809,8 @@ Loop:
case response := <-responseChan:
if response.StatusCode != 200 {
log.Errorln("Got failure status code:", response.StatusCode)
lastError = errors.New("failure status code")
lastError = &HttpErrResp{response.StatusCode, fmt.Sprintf("Request failed (HTTP status %d)",
response.StatusCode)}
break Loop
}
break Loop
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,12 @@ func DoStashCPSingle(sourceFile string, destination string, methods []string, re
ns, err := namespaces.MatchNamespace(dest_url.Path)
if err != nil {
log.Errorln("Failed to get namespace information:", err)
AddError(err)
return 0, err
}
return doWriteBack(source_url.Path, dest_url, ns)
_, err = doWriteBack(source_url.Path, dest_url, ns)
AddError(err)
return 0, err
}

if dest_url.Scheme == "file" {
Expand Down
Loading