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:
commit
8e8794790a
1 changed files with 13 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue