Transcoder misc fixes (#1144)

Co-authored-by: Fred Heinecke <fred.heinecke@yahoo.com>
This commit is contained in:
Zoe Roux 2025-11-09 19:07:20 +01:00 committed by GitHub
parent 84fcbbbb42
commit b1723c2f2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View File

@ -88,17 +88,13 @@ func (s *MetadataService) extractSubs(ctx context.Context, info *MediaInfo) (err
}
workdir := filepath.Join(os.TempDir(), info.Sha)
if err := os.MkdirAll(workdir, 0660); err != nil {
return fmt.Errorf("failed to create temporary directory: %w", err)
}
attDir := filepath.Join(workdir, "att")
if err := os.MkdirAll(attDir, 0660); err != nil {
if err := os.MkdirAll(attDir, 0770); err != nil {
return fmt.Errorf("failed to create attachment directory: %w", err)
}
subDir := filepath.Join(workdir, "sub")
if err := os.MkdirAll(subDir, 0660); err != nil {
if err := os.MkdirAll(subDir, 0770); err != nil {
return fmt.Errorf("failed to create subtitles directory: %w", err)
}

View File

@ -32,7 +32,10 @@ func (r *RunLock[K, V]) Start(key K) (func() (V, error), func(val V, err error)
task, ok := r.running[key]
if ok {
ret := make(chan Result[V])
// Important: Buffer this so that listener notifications are not blocked
// when the job completes. Without a buffered channel, the "set" function
// can get hung if any one of the listeners does not read from the channel.
ret := make(chan Result[V], 1)
task.listeners = append(task.listeners, ret)
return func() (V, error) {
res := <-ret