refactor: removed indirect call introduced by intellij's refactor

This commit is contained in:
Deluan
2020-03-06 16:28:20 -05:00
parent 9ae14015a1
commit 59356f0029
+2 -4
View File
@@ -71,7 +71,7 @@ func (ms *mediaStreamer) NewStream(ctx context.Context, id string, maxBitRate in
log.Error(ctx, "Error starting transcoder", "id", mf.ID, err) log.Error(ctx, "Error starting transcoder", "id", mf.ID, err)
return nil, os.ErrInvalid return nil, os.ErrInvalid
} }
go copyAndClose(ctx, w, out)() go copyAndClose(ctx, w, out)
} }
// If it is in the cache, check if the stream is done being written. If so, return a ReaderSeeker // If it is in the cache, check if the stream is done being written. If so, return a ReaderSeeker
@@ -100,8 +100,7 @@ func (ms *mediaStreamer) NewStream(ctx context.Context, id string, maxBitRate in
return s, nil return s, nil
} }
func copyAndClose(ctx context.Context, w io.WriteCloser, r io.ReadCloser) func() { func copyAndClose(ctx context.Context, w io.WriteCloser, r io.ReadCloser) {
return func() {
_, err := io.Copy(w, r) _, err := io.Copy(w, r)
if err != nil { if err != nil {
log.Error(ctx, "Error copying data to cache", err) log.Error(ctx, "Error copying data to cache", err)
@@ -115,7 +114,6 @@ func copyAndClose(ctx context.Context, w io.WriteCloser, r io.ReadCloser) func()
log.Error(ctx, "Error closing cache", err) log.Error(ctx, "Error closing cache", err)
} }
} }
}
type Stream struct { type Stream struct {
ctx context.Context ctx context.Context