Skip to content
Permalink
Browse files

Run canvas preview jobs sequentially

Only start the next job when the previous one has completely finished.
Avoids flooding connection pools with too many quick requests.
  • Loading branch information
nyalldawson committed Dec 2, 2017
1 parent 01e8ed8 commit 91c913077c9ba6c01950110cedcf4b8667a6984c
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/gui/qgsmapcanvas.cpp
@@ -634,6 +634,13 @@ void QgsMapCanvas::previewJobFinished()
{
mMap->addPreviewImage( job->renderedImage(), job->mapSettings().extent() );
mPreviewJobs.removeAll( job );

int number = job->property( "number" ).toInt();
if ( number < 8 )
{
startPreviewJob( number + 1 );
}

delete job;
}
}
@@ -2289,14 +2296,10 @@ void QgsMapCanvas::startPreviewJob( int number )
jobSettings.setLayers( previewLayers );

QgsMapRendererQImageJob *job = new QgsMapRendererSequentialJob( jobSettings );
job->setProperty( "number", number );
mPreviewJobs.append( job );
connect( job, &QgsMapRendererJob::finished, this, &QgsMapCanvas::previewJobFinished );
job->start();

if ( number < 8 )
{
schedulePreviewJob( number + 1 );
}
}

void QgsMapCanvas::stopPreviewJobs()

0 comments on commit 91c9130

Please sign in to comment.
You can’t perform that action at this time.