Merge pull request #2192 from strk/2.2.x-no-terminate-pgis-dtor

Do not throw in postgis_datasource destruction if backend is down
This commit is contained in:
Dane Springmeyer 2014-04-04 18:20:52 -07:00
commit 8e8794790a

View file

@ -424,10 +424,19 @@ postgis_datasource::~postgis_datasource()
shared_ptr< Pool<Connection,ConnectionCreator> > pool = ConnectionManager::instance().getPool(creator_.id());
if (pool)
{
shared_ptr<Connection> conn = pool->borrowObject();
if (conn)
{
conn->close();
try {
shared_ptr<Connection> conn = pool->borrowObject();
if (conn)
{
conn->close();
}
} catch (mapnik::datasource_exception const& ex) {
// happens when borrowObject tries to
// create a new connection and fails.
// In turn, new connection would be needed
// when our broke and was thus no good to
// be borrowed
// See https://github.com/mapnik/mapnik/issues/2191
}
}
}