Added a sentinel when UI limit is hit + a message when nothing found, fixes #358
This commit is contained in:
@@ -183,10 +183,10 @@ namespace lms::scanner
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
const auto artists{ db::Artist::findWithMBIDNameVariants(session, lastRetrievedArtist, db::Range{ .offset = 0, .size = batchSize }) };
|
||||
if (artists.results.empty())
|
||||
if (artists.empty())
|
||||
break;
|
||||
|
||||
for (const db::Artist::pointer& artist : artists.results)
|
||||
for (const db::Artist::pointer& artist : artists)
|
||||
{
|
||||
bool hasArtistInfo{};
|
||||
db::ArtistInfo::find(session, artist->getId(), db::Range{ .offset = 0, .size = 1 }, [&](const db::ArtistInfo::pointer&) {
|
||||
@@ -218,7 +218,7 @@ namespace lms::scanner
|
||||
}
|
||||
}
|
||||
|
||||
if (!artists.moreResults)
|
||||
if (artists.size() < batchSize)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace lms::scanner
|
||||
Session& session{ _db.getTLSSession() };
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
|
||||
const RangeResults<TrackId> tracks = Track::findIdsTrackMBIDDuplicates(session);
|
||||
for (const TrackId trackId : tracks.results)
|
||||
const std::vector<TrackId> tracks = Track::findIdsTrackMBIDDuplicates(session);
|
||||
for (const TrackId trackId : tracks)
|
||||
{
|
||||
if (_abortScan)
|
||||
break;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace lms::scanner
|
||||
Genre::FindParameters params;
|
||||
params.setRange(range);
|
||||
auto transaction{ dbSession.createReadTransaction() };
|
||||
return std::move(Genre::findIds(dbSession, params).results);
|
||||
return Genre::findIds(dbSession, params);
|
||||
}() };
|
||||
|
||||
for (const GenreId genreId : genreIds)
|
||||
@@ -65,6 +65,7 @@ namespace lms::scanner
|
||||
trackCount = Genre::computeTrackCount(dbSession, genreId);
|
||||
releaseCount = Genre::computeReleaseCount(dbSession, genreId);
|
||||
}
|
||||
|
||||
{
|
||||
auto transaction{ dbSession.createWriteTransaction() };
|
||||
auto genre{ Genre::find(dbSession, genreId) };
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace lms::scanner
|
||||
|
||||
db::Session& session{ _db.getTLSSession() };
|
||||
|
||||
db::RangeResults<IdType> entries;
|
||||
std::vector<IdType> entries;
|
||||
while (!_abortScan)
|
||||
{
|
||||
{
|
||||
@@ -164,16 +164,16 @@ namespace lms::scanner
|
||||
entries = T::findOrphanIds(session, db::Range{ 0, batchSize });
|
||||
};
|
||||
|
||||
if (entries.results.empty())
|
||||
if (entries.empty())
|
||||
break;
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
|
||||
session.destroy<T>(entries.results);
|
||||
session.destroy<T>(entries);
|
||||
}
|
||||
|
||||
context.currentStepStats.processedElems += entries.results.size();
|
||||
context.currentStepStats.processedElems += entries.size();
|
||||
_progressCallback(context.currentStepStats);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace lms::scanner
|
||||
|
||||
constexpr std::size_t batchSize = 100;
|
||||
|
||||
db::RangeResults<db::DirectoryId> entries;
|
||||
std::vector<db::DirectoryId> entries;
|
||||
while (!_abortScan)
|
||||
{
|
||||
{
|
||||
@@ -67,7 +67,7 @@ namespace lms::scanner
|
||||
entries = db::Directory::findMismatchedLibrary(session, db::Range{ 0, batchSize }, mediaLibrary.rootDirectory, mediaLibrary.id);
|
||||
};
|
||||
|
||||
if (entries.results.empty())
|
||||
if (entries.empty())
|
||||
break;
|
||||
|
||||
{
|
||||
@@ -77,7 +77,7 @@ namespace lms::scanner
|
||||
if (!library) // may be legit
|
||||
break;
|
||||
|
||||
for (const db::DirectoryId directoryId : entries.results)
|
||||
for (const db::DirectoryId directoryId : entries)
|
||||
{
|
||||
if (_abortScan)
|
||||
break;
|
||||
@@ -87,7 +87,7 @@ namespace lms::scanner
|
||||
}
|
||||
}
|
||||
|
||||
context.currentStepStats.processedElems += entries.results.size();
|
||||
context.currentStepStats.processedElems += entries.size();
|
||||
_progressCallback(context.currentStepStats);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user