Rework DB session + transactions. Now can handle multiple read only transactions in parallel

This commit is contained in:
emeric
2019-07-16 13:17:23 +02:00
parent 2a1fb0182b
commit 38ce2600d2
79 changed files with 1840 additions and 1369 deletions
+7 -10
View File
@@ -63,21 +63,18 @@ ArtistInfo::refresh()
if (!artistId)
return;
auto artistsIds = getService<Similarity::Searcher>()->getSimilarArtists(LmsApp->getDboSession(), *artistId, 5);
const std::vector<Database::IdType> artistsIds {getService<Similarity::Searcher>()->getSimilarArtists(LmsApp->getDbSession(), *artistId, 5)};
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
auto transaction {LmsApp->getDbSession().createSharedTransaction()};
std::vector<Database::Artist::pointer> artists;
for (auto artistId : artistsIds)
for (Database::IdType artistId : artistsIds)
{
auto artist = Database::Artist::getById(LmsApp->getDboSession(), artistId);
Database::Artist::pointer artist {Database::Artist::getById(LmsApp->getDbSession(), artistId)};
if (!artist)
continue;
if (artist)
artists.push_back(artist);
}
for (auto artist : artists)
_similarArtistsContainer->addNew<ArtistLink>(artist);
}
}
} // namespace UserInterface