Modify: close file in main routine

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

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():