feat: fix NotifyOnce map key to use composite ArtistID+RGID
This commit is contained in:
@@ -43,13 +43,16 @@ func NotifyOnce(ctx context.Context, db *database.DB, sender Sender, cfg config.
|
||||
// Authoritative missing set: external releases with no matching local album.
|
||||
// This is what the Web UI dashboard also shows, so the digest stays
|
||||
// consistent with what the operator sees in the UI.
|
||||
// Using composite key ArtistID|RGID to be defensive - while MusicBrainz RGIDs are
|
||||
// globally unique (UUIDs), this protects against potential data inconsistencies.
|
||||
missing, err := scanner.ScanAll(ctx, db, threshold)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("notifier: scan missing releases: %w", err)
|
||||
}
|
||||
missingByRGID := make(map[string]scanner.MissingRelease, len(missing))
|
||||
missingByArtistRGID := make(map[string]scanner.MissingRelease, len(missing))
|
||||
for _, m := range missing {
|
||||
missingByRGID[m.RGID] = m
|
||||
key := m.ArtistID + "|" + m.RGID
|
||||
missingByArtistRGID[key] = m
|
||||
}
|
||||
|
||||
// Restrict to releases not yet notified. A release that is genuinely missing
|
||||
@@ -61,7 +64,8 @@ func NotifyOnce(ctx context.Context, db *database.DB, sender Sender, cfg config.
|
||||
|
||||
toNotify := make([]scanner.MissingRelease, 0, len(unnotified))
|
||||
for _, r := range unnotified {
|
||||
if m, ok := missingByRGID[r.RGID]; ok {
|
||||
key := r.ArtistID + "|" + r.RGID
|
||||
if m, ok := missingByArtistRGID[key]; ok {
|
||||
toNotify = append(toNotify, m)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user