Modify: close file in main routine

This commit is contained in:
HFO4 committed 2019-12-11 18:52:41 +08:00
1 parent d0bb123e03
commit 18968458a4
7 files changed
+30 -5

No files matched your search

+2 -1
View File
@@ -32,12 +32,13 @@ func (handler Handler) Get(ctx context.Context, path string) (io.ReadSeeker, err
}
// 开启一个协程,用于请求结束后关闭reader
go closeReader(ctx, file)
// go closeReader(ctx, file)
return file, nil
}
// closeReader 用于在请求结束后关闭reader
// TODO 让业务代码自己关闭
func closeReader(ctx context.Context, closer io.Closer) {
select {
case <-ctx.Done():