Skip to content

Commit

Permalink
Merge pull request #1526 from 0chain/fix/getref-timeout
Browse files Browse the repository at this point in the history
Increase timeout and check eof
  • Loading branch information
dabasov authored Jun 14, 2024
2 parents 80ec46e + 422337a commit 89b23cc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions zboxcore/sdk/deleteworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sdk
import (
"context"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
Expand Down Expand Up @@ -78,6 +79,10 @@ func (req *DeleteRequest) deleteBlobberFile(
cncl()

if err != nil {
if err == io.EOF {
shouldContinue = true
return
}
logger.Logger.Error(blobber.Baseurl, "Delete: ", err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion zboxcore/sdk/filerefsworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (o *ObjectTreeRequest) getFileRefs(oTR *oTreeResponse, bUrl string) {
return
}
oResult := ObjectTreeResult{}
ctx, cncl := context.WithTimeout(o.ctx, time.Second*30)
ctx, cncl := context.WithTimeout(o.ctx, 2*time.Minute)
err = zboxutil.HttpDo(ctx, cncl, oReq, func(resp *http.Response, err error) error {
if err != nil {
l.Logger.Error(err)
Expand Down
4 changes: 1 addition & 3 deletions zboxcore/sdk/multi_operation_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ func (mo *MultiOperation) Process() error {
fmt.Sprintf("Multioperation failed. Required consensus %d got %d. Major error: %s",
mo.consensusThresh, mo.operationMask.CountOnes(), majorErr.Error()))
}
return errors.New("consensus_not_met",
fmt.Sprintf("Multioperation failed. Required consensus %d got %d",
mo.consensusThresh, mo.operationMask.CountOnes()))
return nil
}

// Take transpose of mo.change because it will be easier to iterate mo if it contains blobber changes
Expand Down
6 changes: 4 additions & 2 deletions zboxcore/sdk/renameworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"mime/multipart"
"net/http"
"path/filepath"
"sync"
"time"

Expand Down Expand Up @@ -301,8 +302,6 @@ type RenameOperation struct {
}

func (ro *RenameOperation) Process(allocObj *Allocation, connectionID string) ([]fileref.RefEntity, zboxutil.Uint128, error) {

l.Logger.Info("Started Rename Process with Connection Id", connectionID)
// make renameRequest object
rR := &RenameRequest{
allocationObj: allocObj,
Expand All @@ -319,6 +318,9 @@ func (ro *RenameOperation) Process(allocObj *Allocation, connectionID string) ([
wg: &sync.WaitGroup{},
consensus: Consensus{RWMutex: &sync.RWMutex{}},
}
if filepath.Base(ro.remotefilepath) == ro.newName {
return nil, ro.renameMask, errors.New("invalid_operation", "Cannot rename to same name")
}
rR.consensus.fullconsensus = ro.consensus.fullconsensus
rR.consensus.consensusThresh = ro.consensus.consensusThresh

Expand Down

0 comments on commit 89b23cc

Please sign in to comment.