diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2019-01-10 09:02:13 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-10 09:02:13 -0800 |
| commit | e978f3aaaba844f9b8def8fa9aed7872595f3245 (patch) | |
| tree | 3d000a41408651ef4d2b6331501c550387c4a5a7 /weed/operation/stats.go | |
| parent | 2a75a36b275ea7f47a95ad2efc70be22d5ed3fe2 (diff) | |
| parent | 39c745588111cebef0475f2453ee0715e0153c49 (diff) | |
| download | seaweedfs-e978f3aaaba844f9b8def8fa9aed7872595f3245.tar.xz seaweedfs-e978f3aaaba844f9b8def8fa9aed7872595f3245.zip | |
Merge pull request #829 from PapaYofen/fix-823
Fix https://github.com/chrislusf/seaweedfs/issues/823
Diffstat (limited to 'weed/operation/stats.go')
| -rw-r--r-- | weed/operation/stats.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/operation/stats.go b/weed/operation/stats.go index 277b0e835..364727272 100644 --- a/weed/operation/stats.go +++ b/weed/operation/stats.go @@ -2,6 +2,7 @@ package operation import ( "context" + "time" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" ) @@ -9,7 +10,10 @@ import ( func Statistics(server string, req *master_pb.StatisticsRequest) (resp *master_pb.StatisticsResponse, err error) { err = withMasterServerClient(server, func(masterClient master_pb.SeaweedClient) error { - grpcResponse, grpcErr := masterClient.Statistics(context.Background(), req) + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) + defer cancel() + + grpcResponse, grpcErr := masterClient.Statistics(ctx, req) if grpcErr != nil { return grpcErr } |
