Skip to content

Commit

Permalink
Longer deadline for fixing files (#9297)
Browse files Browse the repository at this point in the history
  • Loading branch information
stereosteve authored Jul 30, 2024
1 parent f713455 commit df1c126
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mediorum/server/replicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (ss *MediorumServer) pullFileFromHost(host, cid string) error {
return errors.New("should not pull blob from self")
}
client := http.Client{
Timeout: time.Minute,
Timeout: time.Minute * 3,
}
u := apiPath(host, "internal/blobs", url.PathEscape(cid))

Expand Down
14 changes: 9 additions & 5 deletions mediorum/server/serve_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ func (ss *MediorumServer) serveBlobLocation(c echo.Context) error {
return 1
})

if fix, _ := strconv.ParseBool(c.QueryParam("fix")); fix {
if len(attrs) > 0 {
best := attrs[0]
if err := ss.pullFileFromHost(best.Host, cid); err != nil {
return err
if fix, _ := strconv.ParseBool(c.QueryParam("fix")); fix && len(attrs) > 0 {
best := attrs[0]
for _, a := range attrs {
if a.Attr.Size < best.Attr.Size {
break
}
if err := ss.pullFileFromHost(a.Host, cid); err == nil {
break
}
}

}
}

Expand Down

0 comments on commit df1c126

Please sign in to comment.