mapnik-org/mapnik — Issue #630: timeout on lengthy postgis queries
Author: artemp
Created: 2011-10-11 08:05:48+00:00
State: open
Labels: PostGIS_Input_Driver

Rendering requests generated by the 'export' tab on the OSM web site sometimes cause Mapnik to issue queries which run for over 10 minutes. When this happens I'd like to be able to automatically cancel these and return an error.

The patch attached is my first attempt at implementing this in mapnik2. It allows a timeout parameter to be added to the postgis datasource parameters:

1000

The timeout is specified in miliseconds which matches the underlying Postgres "SET statement_timeout=..." request, ie. 1000 is a one second timeout.

If the timeout triggers then the code throws "mapnik::datasource_query_cancelled_exception".

The patch seems to work OK but may need a bit more work. Ideally I'd like some way to set the timeout after an XML style has been loaded so I can use the same XML file for the main rendering daemon and the export tab, but only enable the timeout for the export rendering.