Closed vs49688 closed 1 year ago
This is very strange indeed. I was not able to reproduce it locally. Regarding your PR, we could use that approach as a workaround, but still caching the values, so it would "re-add" the genres only once. I'm gonna work on something like this. Thanks for the investigation!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Description
Sometimes
genreRepository::GetAll()
returns an empty result set, when there are in fact, results.This can manifest as #1564. Before scanning, Navidrome caches all the known genres via
cachedGenreRepo
(which callsGetAll()
). Because the cache is empty, the scanner tries toINSERT
all the existing genres, causing theUNIQUE constraint failed: genre.name
errors, as seen in #1564 .Expected Behaviour
genreRepository::GetAll()
to return the correct results.Steps to reproduce
This is annoying to reproduce, as it only seems to happen on some systems, mine being one of them.
touch
existing ones)Platform information
log.Debug
patchesNixOS 22.05.20221003.81a3237 (Quokka)
Additional information
I've traced this down to the
GetAll()
query not returning any results in Navidrome. Suspiciously, the same exact query does return results when run via thesqlite3
cli:Logs, with some extra
log.Debug
s I've littered around the place. Specifically take note of after thelevel=debug msg="XXX: newCachedGenreResository()/GetAll() BEGIN"
line.