[QGIS-Developer] QGIS Server does not wait for remote SVG before rendering

René-Luc Dhont rldhont at gmail.com
Tue Sep 24 07:06:33 PDT 2019


Hi devs,

I have started to work on fixing this issue 
https://github.com/qgis/QGIS/pull/31930

I was thinking, I have found a solution to force QGIS Server to wait for 
loading remote SVG before rendering.
But it seems that I am not able to determine if a task is running or 
will be ran.

Just after fetching SVGs, I wrote this code :

     if ( QgsApplication::taskManager()->countActiveTasks() > 0 )
     {
       QEventLoop loop;
       QObject::connect( QgsApplication::taskManager(), 
&QgsTaskManager::allTasksFinished, &loop, &QEventLoop::quit );
       loop.exec();
     }

When a task is added, does the number of active tasks increase?
Is the number of active tasks null when all the task has been performed ?
If the number of active tasks is null, are all tasks finished ?

Thansk for your help,
René-Luc


Le 05/07/2019 à 00:48, Nyall Dawson a écrit :
> On Thu, 4 Jul 2019 at 23:08, René-Luc Dhont <rldhont at gmail.com> wrote:
>> Hi devs,
>>
>> We encountered a strange issue with QGIS Server, a point layer with a
>> simple style using a remote SVG.
>>
>> At the first GetMap request to this layer, QGIS Server rendered an image
>> with missing symbol, the ?.
>>
>> At the second same GetMap Request, QGIS Server rendered an image with
>> the remote SVG.
>>
>> And sometimes the remote SVG is not drawn and replaced by the  ?.
>>
>> Do you know if the renderer or the styler has a timer to wait for SVG ?
>> Is It configurable ? or the context can be configured to wait for svg or
>> an error ?
> On the desktop it's done in a background thread, and the svg/raster
> image caches fire a signal when the image is downloaded, triggering a
> canvas refresh.
>
> I'm not sure how you could address this with server. Maybe either:
> 1. (ugly) push some flag via the render context to force the renderer
> to wait until a required svg is downloaded, and push this flag into
> the svg/ raster image caches.
> 2. (out of the box) use https://github.com/qgis/QGIS/pull/30522 to
> check in advance for any remote svg/images required in a project, and
> prefetch all these on server startup BEFORE any rendering operation is
> requested.
>
> Nyall
>
>> Regards,
>> René-Luc
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



More information about the QGIS-Developer mailing list