Commit 145b25c5 authored by Marcel Wiesweg's avatar Marcel Wiesweg
Browse files

The DAlbums scan can be costly for some setup as it sends large amounts of...

The DAlbums scan can be costly for some setup as it sends large amounts of data over the SQL connection.
- reduce the timer limit to one minute
- do not kill the running job if the timer fired again while the job was running.

CCBUG: 324287
parent c2ba1fa1
......@@ -321,11 +321,11 @@ AlbumManager::AlbumManager()
// this operation is much more expensive than the other scan methods
d->scanDAlbumsTimer = new QTimer(this);
d->scanDAlbumsTimer->setInterval(5000);
d->scanDAlbumsTimer->setInterval(60 * 1000);
d->scanDAlbumsTimer->setSingleShot(true);
connect(d->scanDAlbumsTimer, SIGNAL(timeout()),
this, SLOT(scanDAlbums()));
this, SLOT(scanDAlbumsScheduled()));
// moderately expensive
d->albumItemCountTimer = new QTimer(this);
......@@ -1719,6 +1719,17 @@ void AlbumManager::scanSAlbums()
}
}
void AlbumManager::scanDAlbumsScheduled()
{
// Avoid a cycle of killing a job which takes longer than the timer interval
if (d->dateListJob)
{
d->scanDAlbumsTimer->start();
return;
}
scanDAlbums();
}
void AlbumManager::scanDAlbums()
{
d->scanDAlbumsTimer->stop();
......
......@@ -685,6 +685,7 @@ private Q_SLOTS:
* Scan dates from the database (via IOSlave) and
* updates the DAlbums.
*/
void scanDAlbumsScheduled();
void scanDAlbums();
void getAlbumItemsCount();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment