diff --git a/model/tag_mappings.go b/model/tag_mappings.go index 8e8bbc5bd..ce7d2f37b 100644 --- a/model/tag_mappings.go +++ b/model/tag_mappings.go @@ -137,12 +137,12 @@ type artistSplitExceptionsCache struct { var artistSplitExceptions atomic.Pointer[artistSplitExceptionsCache] -// ArtistSplitExceptionsRx returns the regex for Scanner.ArtistSplitExceptions, +// artistSplitExceptionsRx returns the regex for Scanner.ArtistSplitExceptions, // or nil if none are configured. Compiled lazily (config hooks only run once // per process, before tests can override the option) and cached until the // configured list changes. Lock-free on the cache-hit path, as this is called // per tag mapping per scanned file, across concurrent scanner goroutines. -func ArtistSplitExceptionsRx() *regexp.Regexp { +func artistSplitExceptionsRx() *regexp.Regexp { names := conf.Server.Scanner.ArtistSplitExceptions if c := artistSplitExceptions.Load(); c != nil && slices.Equal(c.names, names) { return c.rx @@ -174,7 +174,7 @@ var participantTagNames = sync.OnceValue(func() map[TagName]struct{} { // exceptions attached when name is a participant (artist/role) tag. func (c TagConf) WithParticipantExceptions(name TagName) TagConf { if _, ok := participantTagNames()[name]; ok { - c.ExceptionsRx = ArtistSplitExceptionsRx() + c.ExceptionsRx = artistSplitExceptionsRx() } return c } diff --git a/model/tag_mappings_test.go b/model/tag_mappings_test.go index c1eb4afba..e582c3f2f 100644 --- a/model/tag_mappings_test.go +++ b/model/tag_mappings_test.go @@ -144,30 +144,30 @@ var _ = Describe("TagConf", func() { }) }) - Describe("ArtistSplitExceptionsRx", func() { + Describe("artistSplitExceptionsRx", func() { BeforeEach(func() { DeferCleanup(configtest.SetupConfig()) }) It("returns nil when no exceptions are configured", func() { conf.Server.Scanner.ArtistSplitExceptions = nil - Expect(ArtistSplitExceptionsRx()).To(BeNil()) + Expect(artistSplitExceptionsRx()).To(BeNil()) }) It("compiles the configured exceptions", func() { conf.Server.Scanner.ArtistSplitExceptions = []string{"Iron and Wine"} - rx := ArtistSplitExceptionsRx() + rx := artistSplitExceptionsRx() Expect(rx).ToNot(BeNil()) Expect(rx.MatchString("iron and wine")).To(BeTrue()) }) It("caches the compiled regex until the configuration changes", func() { conf.Server.Scanner.ArtistSplitExceptions = []string{"Iron and Wine"} - first := ArtistSplitExceptionsRx() - Expect(ArtistSplitExceptionsRx()).To(BeIdenticalTo(first)) + first := artistSplitExceptionsRx() + Expect(artistSplitExceptionsRx()).To(BeIdenticalTo(first)) conf.Server.Scanner.ArtistSplitExceptions = []string{"AC/DC"} - second := ArtistSplitExceptionsRx() + second := artistSplitExceptionsRx() Expect(second).ToNot(BeIdenticalTo(first)) Expect(second.MatchString("AC/DC")).To(BeTrue()) })