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
+5 -5
View File
@@ -74,10 +74,10 @@ TracksInfo::TracksInfo()
void
TracksInfo::refreshRecentlyAdded()
{
auto after = Wt::WLocalDateTime::currentServerDateTime().toUTC().addMonths(-1);
const auto after {Wt::WLocalDateTime::currentServerDateTime().toUTC().addMonths(-1)};
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
auto tracks = Track::getLastAdded(LmsApp->getDboSession(), after, 5);
auto transaction {LmsApp->getDbSession().createSharedTransaction()};
const auto tracks {Track::getLastAdded(LmsApp->getDbSession(), after, 5)};
_recentlyAddedContainer->clear();
addEntries(_recentlyAddedContainer, tracks);
@@ -86,8 +86,8 @@ TracksInfo::refreshRecentlyAdded()
void
TracksInfo::refreshMostPlayed()
{
Wt::Dbo::Transaction transaction(LmsApp->getDboSession());
auto tracks = LmsApp->getUser()->getPlayedTrackList()->getTopTracks(5);
auto transaction {LmsApp->getDbSession().createSharedTransaction()};
const auto tracks {LmsApp->getUser()->getPlayedTrackList(LmsApp->getDbSession())->getTopTracks(5)};
_mostPlayedContainer->clear();
addEntries(_mostPlayedContainer, tracks);