Cleanup file stream cache

This commit is contained in:
Zoe Roux 2024-07-25 19:22:04 +02:00
parent f16fa9686c
commit c5047babca

View File

@ -34,12 +34,11 @@ func NewTranscoder() (*Transcoder, error) {
} }
func (t *Transcoder) getFileStream(path string, sha string) (*FileStream, error) { func (t *Transcoder) getFileStream(path string, sha string) (*FileStream, error) {
var err error ret, _ := t.streams.GetOrCreate(sha, func() *FileStream {
ret, _ := t.streams.GetOrCreate(path, func() *FileStream {
return NewFileStream(path, sha) return NewFileStream(path, sha)
}) })
ret.ready.Wait() ret.ready.Wait()
if err != nil || ret.err != nil { if ret.err != nil {
t.streams.Remove(path) t.streams.Remove(path)
return nil, ret.err return nil, ret.err
} }