Do not throw in postgis_datasource destruction if backend is down

... and persist_connections is true!
Closes #2191
This commit is contained in:
Sandro Santilli 2014-03-26 15:32:09 +01:00
parent e618a65498
commit 32680434fe

View file

@ -445,10 +445,19 @@ postgis_datasource::~postgis_datasource()
CnxPool_ptr 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
}
}
}