mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +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();
|
||||
}
|
||||
|
||||
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:
|
||||
RabbitMQConnection(const RabbitMQConfiguration & configuration_, Poco::Logger * log_);
|
||||
|
||||
~RabbitMQConnection();
|
||||
|
||||
bool isConnected();
|
||||
|
||||
bool connect();
|
||||
|
@ -621,7 +621,6 @@ void StorageRabbitMQ::prepareChannelForConsumer(RabbitMQConsumerPtr consumer)
|
||||
consumer->setupChannel();
|
||||
}
|
||||
|
||||
|
||||
void StorageRabbitMQ::unbindExchange()
|
||||
{
|
||||
/* 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;
|
||||
|
||||
LOG_TRACE(log, "Deactivating background tasks");
|
||||
|
||||
/// In case it has not yet been able to setup connection;
|
||||
deactivateTask(connection_task, true, false);
|
||||
|
||||
@ -820,6 +821,8 @@ void StorageRabbitMQ::shutdown()
|
||||
deactivateTask(streaming_task, true, false);
|
||||
deactivateTask(looping_task, true, true);
|
||||
|
||||
LOG_TRACE(log, "Cleaning up RabbitMQ after table usage");
|
||||
|
||||
/// Just a paranoid try catch, it is not actually needed.
|
||||
try
|
||||
{
|
||||
@ -842,6 +845,8 @@ void StorageRabbitMQ::shutdown()
|
||||
{
|
||||
tryLogCurrentException(log);
|
||||
}
|
||||
|
||||
LOG_TRACE(log, "Shutdown finished");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user