aboutsummaryrefslogtreecommitdiff
path: root/weed/operation/delete_content.go
diff options
context:
space:
mode:
authorchenwanli <chenwanli@sensetime.com>2019-01-10 16:43:44 +0800
committerchenwanli <chenwanli@sensetime.com>2019-01-10 19:41:03 +0800
commit0a3e83a36a067a282a3cecec06d7bb577f1822ba (patch)
tree01ff3a3bf86f1cf81a34e0bc958ba1b0f93138b9 /weed/operation/delete_content.go
parent2a75a36b275ea7f47a95ad2efc70be22d5ed3fe2 (diff)
downloadseaweedfs-0a3e83a36a067a282a3cecec06d7bb577f1822ba.tar.xz
seaweedfs-0a3e83a36a067a282a3cecec06d7bb577f1822ba.zip
Set timeout for master and volume non-streaming rpc
Diffstat (limited to 'weed/operation/delete_content.go')
-rw-r--r--weed/operation/delete_content.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/operation/delete_content.go b/weed/operation/delete_content.go
index e15859d15..3e468e1a3 100644
--- a/weed/operation/delete_content.go
+++ b/weed/operation/delete_content.go
@@ -7,6 +7,7 @@ import (
"net/http"
"strings"
"sync"
+ "time"
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
)
@@ -108,12 +109,14 @@ func DeleteFilesWithLookupVolumeId(fileIds []string, lookupFunc func(vid []strin
func DeleteFilesAtOneVolumeServer(volumeServer string, fileIds []string) (ret []*volume_server_pb.DeleteResult, err error) {
err = WithVolumeServerClient(volumeServer, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
+ ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second))
+ defer cancel()
req := &volume_server_pb.BatchDeleteRequest{
FileIds: fileIds,
}
- resp, err := volumeServerClient.BatchDelete(context.Background(), req)
+ resp, err := volumeServerClient.BatchDelete(ctx, req)
// fmt.Printf("deleted %v %v: %v\n", fileIds, err, resp)