mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-18 21:07:44 +03:00
Use a custom artist image cache key.
Invalidate when `Agents` config changes. This should solve https://github.com/navidrome/navidrome/issues/1601#issuecomment-1241702797
This commit is contained in:
parent
94c6d47181
commit
ab7668f562
@ -2,6 +2,7 @@ package artwork
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
@ -12,6 +13,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Masterminds/squirrel"
|
"github.com/Masterminds/squirrel"
|
||||||
|
"github.com/navidrome/navidrome/conf"
|
||||||
"github.com/navidrome/navidrome/core"
|
"github.com/navidrome/navidrome/core"
|
||||||
"github.com/navidrome/navidrome/log"
|
"github.com/navidrome/navidrome/log"
|
||||||
"github.com/navidrome/navidrome/model"
|
"github.com/navidrome/navidrome/model"
|
||||||
@ -57,6 +59,17 @@ func newArtistReader(ctx context.Context, artwork *artwork, artID model.ArtworkI
|
|||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *artistReader) Key() string {
|
||||||
|
agentsHash := md5.Sum([]byte(conf.Server.Agents + conf.Server.Spotify.ID))
|
||||||
|
return fmt.Sprintf(
|
||||||
|
"%s.%d.%d.%x",
|
||||||
|
a.artID,
|
||||||
|
a.lastUpdate.UnixMilli(),
|
||||||
|
a.size,
|
||||||
|
agentsHash,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *artistReader) LastUpdated() time.Time {
|
func (a *artistReader) LastUpdated() time.Time {
|
||||||
return a.lastUpdate
|
return a.lastUpdate
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user