aboutsummaryrefslogtreecommitdiff
path: root/unmaintained/diff_volume_servers/diff_volume_servers.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-09-09 12:07:15 -0700
committerChris Lu <chris.lu@gmail.com>2020-09-09 12:07:15 -0700
commitdaf0a449f7424d4a8252673509af5afd0b9bd8ec (patch)
treee9b9ba152b2fade26b71e7710ae6730dafe9d39e /unmaintained/diff_volume_servers/diff_volume_servers.go
parent7f69acd1f21b4e42afff155b633419eda17af331 (diff)
downloadseaweedfs-daf0a449f7424d4a8252673509af5afd0b9bd8ec.tar.xz
seaweedfs-daf0a449f7424d4a8252673509af5afd0b9bd8ec.zip
properly cancel context for streaming grpc
Diffstat (limited to 'unmaintained/diff_volume_servers/diff_volume_servers.go')
-rw-r--r--unmaintained/diff_volume_servers/diff_volume_servers.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/unmaintained/diff_volume_servers/diff_volume_servers.go b/unmaintained/diff_volume_servers/diff_volume_servers.go
index 4de864980..6107f3d48 100644
--- a/unmaintained/diff_volume_servers/diff_volume_servers.go
+++ b/unmaintained/diff_volume_servers/diff_volume_servers.go
@@ -124,7 +124,9 @@ type needleState struct {
func getVolumeFiles(v uint32, addr string) (map[types.NeedleId]needleState, int64, error) {
var idxFile *bytes.Reader
err := operation.WithVolumeServerClient(addr, grpcDialOption, func(vs volume_server_pb.VolumeServerClient) error {
- copyFileClient, err := vs.CopyFile(context.Background(), &volume_server_pb.CopyFileRequest{
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+ copyFileClient, err := vs.CopyFile(ctx, &volume_server_pb.CopyFileRequest{
VolumeId: v,
Ext: ".idx",
CompactionRevision: math.MaxUint32,