Add timeout for artwork extraction
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/dhowden/tag"
|
"github.com/dhowden/tag"
|
||||||
"github.com/disintegration/imaging"
|
"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) {
|
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 artID model.ArtworkID
|
||||||
var err error
|
var err error
|
||||||
if id != "" {
|
if id != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user