mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Add logging, remove closing connection in destructor
This commit is contained in:
parent
283388cfa6
commit
2e758f983f
@ -122,24 +122,4 @@ void RabbitMQConnection::disconnectImpl(bool immediately)
|
|||||||
event_handler.iterateLoop();
|
event_handler.iterateLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
RabbitMQConnection::~RabbitMQConnection()
|
|
||||||
{
|
|
||||||
std::lock_guard lock(mutex);
|
|
||||||
|
|
||||||
if (!connection)
|
|
||||||
return;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
/// Try to always close the connection gracefully (run the loop to see the closing callbacks)
|
|
||||||
/// to make sure that the associated callbacks and pending events are removed
|
|
||||||
/// before handler and loop are destructed.
|
|
||||||
disconnectImpl();
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,6 @@ class RabbitMQConnection
|
|||||||
public:
|
public:
|
||||||
RabbitMQConnection(const RabbitMQConfiguration & configuration_, Poco::Logger * log_);
|
RabbitMQConnection(const RabbitMQConfiguration & configuration_, Poco::Logger * log_);
|
||||||
|
|
||||||
~RabbitMQConnection();
|
|
||||||
|
|
||||||
bool isConnected();
|
bool isConnected();
|
||||||
|
|
||||||
bool connect();
|
bool connect();
|
||||||
|
@ -621,7 +621,6 @@ void StorageRabbitMQ::prepareChannelForConsumer(RabbitMQConsumerPtr consumer)
|
|||||||
consumer->setupChannel();
|
consumer->setupChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void StorageRabbitMQ::unbindExchange()
|
void StorageRabbitMQ::unbindExchange()
|
||||||
{
|
{
|
||||||
/* This is needed because with RabbitMQ (without special adjustments) can't, for example, properly make mv if there was insert query
|
/* This is needed because with RabbitMQ (without special adjustments) can't, for example, properly make mv if there was insert query
|
||||||
@ -812,6 +811,8 @@ void StorageRabbitMQ::shutdown()
|
|||||||
{
|
{
|
||||||
shutdown_called = true;
|
shutdown_called = true;
|
||||||
|
|
||||||
|
LOG_TRACE(log, "Deactivating background tasks");
|
||||||
|
|
||||||
/// In case it has not yet been able to setup connection;
|
/// In case it has not yet been able to setup connection;
|
||||||
deactivateTask(connection_task, true, false);
|
deactivateTask(connection_task, true, false);
|
||||||
|
|
||||||
@ -820,6 +821,8 @@ void StorageRabbitMQ::shutdown()
|
|||||||
deactivateTask(streaming_task, true, false);
|
deactivateTask(streaming_task, true, false);
|
||||||
deactivateTask(looping_task, true, true);
|
deactivateTask(looping_task, true, true);
|
||||||
|
|
||||||
|
LOG_TRACE(log, "Cleaning up RabbitMQ after table usage");
|
||||||
|
|
||||||
/// Just a paranoid try catch, it is not actually needed.
|
/// Just a paranoid try catch, it is not actually needed.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -842,6 +845,8 @@ void StorageRabbitMQ::shutdown()
|
|||||||
{
|
{
|
||||||
tryLogCurrentException(log);
|
tryLogCurrentException(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOG_TRACE(log, "Shutdown finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user