diff options
| author | chenwanli <chenwanli@sensetime.com> | 2019-01-10 16:43:44 +0800 |
|---|---|---|
| committer | chenwanli <chenwanli@sensetime.com> | 2019-01-10 19:41:03 +0800 |
| commit | 0a3e83a36a067a282a3cecec06d7bb577f1822ba (patch) | |
| tree | 01ff3a3bf86f1cf81a34e0bc958ba1b0f93138b9 /weed/operation/lookup.go | |
| parent | 2a75a36b275ea7f47a95ad2efc70be22d5ed3fe2 (diff) | |
| download | seaweedfs-0a3e83a36a067a282a3cecec06d7bb577f1822ba.tar.xz seaweedfs-0a3e83a36a067a282a3cecec06d7bb577f1822ba.zip | |
Set timeout for master and volume non-streaming rpc
Diffstat (limited to 'weed/operation/lookup.go')
| -rw-r--r-- | weed/operation/lookup.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/operation/lookup.go b/weed/operation/lookup.go index c495af1af..562a11580 100644 --- a/weed/operation/lookup.go +++ b/weed/operation/lookup.go @@ -99,10 +99,13 @@ func LookupVolumeIds(server string, vids []string) (map[string]LookupResult, err //only query unknown_vids err := withMasterServerClient(server, func(masterClient master_pb.SeaweedClient) error { + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) + defer cancel() + req := &master_pb.LookupVolumeRequest{ VolumeIds: unknown_vids, } - resp, grpcErr := masterClient.LookupVolume(context.Background(), req) + resp, grpcErr := masterClient.LookupVolume(ctx, req) if grpcErr != nil { return grpcErr } |
