mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 21:20:49 +00:00
Fix
This commit is contained in:
parent
a0f717619c
commit
f374a71165
@ -49,18 +49,17 @@ class PostgreSQLConnectionHolder
|
||||
{
|
||||
|
||||
using Pool = ConcurrentBoundedQueue<PostgreSQLConnectionPtr>;
|
||||
using PoolPtr = std::shared_ptr<Pool>;
|
||||
|
||||
public:
|
||||
PostgreSQLConnectionHolder(PostgreSQLConnectionPtr connection_, PoolPtr pool_)
|
||||
PostgreSQLConnectionHolder(PostgreSQLConnectionPtr connection_, Pool & pool_)
|
||||
: connection(std::move(connection_))
|
||||
, pool(std::move(pool_))
|
||||
, pool(pool_)
|
||||
{
|
||||
}
|
||||
|
||||
PostgreSQLConnectionHolder(const PostgreSQLConnectionHolder & other) = delete;
|
||||
|
||||
~PostgreSQLConnectionHolder() { pool->tryPush(connection); }
|
||||
~PostgreSQLConnectionHolder() { pool.tryPush(connection); }
|
||||
|
||||
pqxx::connection & conn() const { return *connection->get(); }
|
||||
|
||||
@ -68,7 +67,7 @@ public:
|
||||
|
||||
private:
|
||||
PostgreSQLConnectionPtr connection;
|
||||
PoolPtr pool;
|
||||
Pool & pool;
|
||||
};
|
||||
|
||||
using PostgreSQLConnectionHolderPtr = std::shared_ptr<PostgreSQLConnectionHolder>;
|
||||
|
@ -48,11 +48,11 @@ PostgreSQLConnectionHolderPtr PostgreSQLConnectionPool::get()
|
||||
PostgreSQLConnectionPtr connection;
|
||||
if (pool->tryPop(connection, POSTGRESQL_POOL_WAIT_MS))
|
||||
{
|
||||
return std::make_shared<PostgreSQLConnectionHolder>(connection, pool);
|
||||
return std::make_shared<PostgreSQLConnectionHolder>(connection, *pool);
|
||||
}
|
||||
|
||||
connection = std::make_shared<PostgreSQLConnection>(connection_str, address);
|
||||
return std::make_shared<PostgreSQLConnectionHolder>(connection, pool);
|
||||
return std::make_shared<PostgreSQLConnectionHolder>(connection, *pool);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user