mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
style(artwork): fix comment accuracy and budget; fingerprint ArtistImageFolder
Correct the inverted workerDeps.extGate comment, trim over-budget doc comments, and add conf.Server.ArtistImageFolder to the resolution fingerprint so an image-folder change re-resolves artist artwork.
This commit is contained in:
parent
bab9b5cd3a
commit
0fbbd01357
@ -26,8 +26,8 @@ var staleAbsentKinds = []string{"ar", "al", "pl", "ra"}
|
||||
// Fingerprint summarizes the config knobs that affect artwork resolution outcomes; a
|
||||
// change means previously resolved (or absent) state may no longer be correct.
|
||||
func Fingerprint() string {
|
||||
raw := fmt.Sprintf("%s|%s|%s|%t|%s",
|
||||
conf.Server.CoverArtPriority, conf.Server.ArtistArtPriority,
|
||||
raw := fmt.Sprintf("%s|%s|%s|%s|%t|%s",
|
||||
conf.Server.CoverArtPriority, conf.Server.ArtistArtPriority, conf.Server.ArtistImageFolder,
|
||||
conf.Server.Agents, conf.Server.EnableExternalServices, consts.Version)
|
||||
sum := md5.Sum([]byte(raw)) //nolint:gosec // fingerprint, not security-sensitive
|
||||
return hex.EncodeToString(sum[:])
|
||||
|
||||
@ -72,6 +72,13 @@ var _ = Describe("Housekeeping", func() {
|
||||
f2 := Fingerprint()
|
||||
Expect(f1).NotTo(Equal(f2))
|
||||
})
|
||||
|
||||
It("changes when ArtistImageFolder changes", func() {
|
||||
conf.Server.ArtistImageFolder = "/before"
|
||||
f1 := Fingerprint()
|
||||
conf.Server.ArtistImageFolder = "/after"
|
||||
Expect(Fingerprint()).NotTo(Equal(f1))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Backfill", func() {
|
||||
|
||||
@ -31,8 +31,8 @@ const (
|
||||
// thumbnailSize is the max dimension fed to blurhash.
|
||||
const thumbnailSize = 128
|
||||
|
||||
// workerDeps are the collaborators processItem needs; extGate is nil outside
|
||||
// tests, in which case resolveItem falls back to a plain passthrough.
|
||||
// workerDeps are the collaborators processItem needs; extGate is set by NewWorker in
|
||||
// production and nil only in tests, where resolveItem falls back to a plain passthrough.
|
||||
type workerDeps struct {
|
||||
ds model.DataStore
|
||||
store *ImageStore
|
||||
|
||||
@ -19,10 +19,8 @@ import (
|
||||
// performance benchmark, so it favors a stable signal over raw speed.
|
||||
const soakCycles = 2200
|
||||
|
||||
// TestWorkerSoak drives processItem across a mix of sources (folder, embedded
|
||||
// extraction, dangling refs) for many cycles, reading each acquired image back
|
||||
// through ImageStore.Open, and asserts goroutines/heap plateau instead of
|
||||
// growing unbounded. Skipped under -short.
|
||||
// TestWorkerSoak runs processItem over many cycles across a mix of sources, asserting
|
||||
// goroutines/heap plateau instead of growing unbounded (a leak guard). Skipped under -short.
|
||||
func TestWorkerSoak(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping soak test in short mode")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user