diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-09-09 12:07:15 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-09-09 12:07:15 -0700 |
| commit | daf0a449f7424d4a8252673509af5afd0b9bd8ec (patch) | |
| tree | e9b9ba152b2fade26b71e7710ae6730dafe9d39e /weed/filesys/dir_rename.go | |
| parent | 7f69acd1f21b4e42afff155b633419eda17af331 (diff) | |
| download | seaweedfs-daf0a449f7424d4a8252673509af5afd0b9bd8ec.tar.xz seaweedfs-daf0a449f7424d4a8252673509af5afd0b9bd8ec.zip | |
properly cancel context for streaming grpc
Diffstat (limited to 'weed/filesys/dir_rename.go')
| -rw-r--r-- | weed/filesys/dir_rename.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.go index 0e417e0ab..b9e9e300b 100644 --- a/weed/filesys/dir_rename.go +++ b/weed/filesys/dir_rename.go @@ -29,6 +29,8 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector // update remote filer err = dir.wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() request := &filer_pb.AtomicRenameEntryRequest{ OldDirectory: dir.FullPath(), @@ -37,7 +39,7 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector NewName: req.NewName, } - _, err := client.AtomicRenameEntry(context.Background(), request) + _, err := client.AtomicRenameEntry(ctx, request) if err != nil { return fuse.EIO } |
