Add timeout for artwork extraction

This commit is contained in:
Deluan 2022-12-25 01:25:10 -05:00 committed by Deluan Quintão
parent 52a4721c91
commit 8cf78efb9c
1 changed files with 4 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import (
"reflect"
"runtime"
"strings"
"time"
"github.com/dhowden/tag"
"github.com/disintegration/imaging"
@ -46,6 +47,9 @@ type artwork struct {
}
func (a *artwork) Get(ctx context.Context, id string, size int) (io.ReadCloser, error) {
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
var artID model.ArtworkID
var err error
if id != "" {