mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
add SCOPE_EXIT
This commit is contained in:
parent
73748075a2
commit
57798a19c0
@ -1101,10 +1101,6 @@ try
|
||||
|
||||
PlacementInfo::PlacementInfo::instance().initialize(config());
|
||||
|
||||
auto cancellation_task_holder = global_context->getSchedulePool().createTask("CancellationChecker", []{ CancellationChecker::getInstance().workerFunction(); });
|
||||
auto cancellation_task = std::make_unique<DB::BackgroundSchedulePoolTaskHolder>(std::move(cancellation_task_holder));
|
||||
(*cancellation_task)->activateAndSchedule();
|
||||
|
||||
zkutil::validateZooKeeperConfig(config());
|
||||
bool has_zookeeper = zkutil::hasZooKeeperConfig(config());
|
||||
|
||||
@ -1249,6 +1245,14 @@ try
|
||||
setOOMScore(oom_score, log);
|
||||
#endif
|
||||
|
||||
auto cancellation_task_holder = global_context->getSchedulePool().createTask("CancellationChecker", []{ CancellationChecker::getInstance().workerFunction(); });
|
||||
auto cancellation_task = std::make_unique<DB::BackgroundSchedulePoolTaskHolder>(std::move(cancellation_task_holder));
|
||||
(*cancellation_task)->activateAndSchedule();
|
||||
|
||||
SCOPE_EXIT({
|
||||
CancellationChecker::getInstance().terminateThread();
|
||||
});
|
||||
|
||||
global_context->setRemoteHostFilter(config());
|
||||
global_context->setHTTPHeaderFilter(config());
|
||||
|
||||
@ -2318,8 +2322,6 @@ try
|
||||
if (current_connections)
|
||||
current_connections = waitServersToFinish(servers, servers_lock, server_settings.shutdown_wait_unfinished);
|
||||
|
||||
CancellationChecker::getInstance().terminateThread();
|
||||
|
||||
if (current_connections)
|
||||
LOG_WARNING(log, "Closed connections. But {} remain."
|
||||
" Tip: To increase wait time add to config: <shutdown_wait_unfinished>60</shutdown_wait_unfinished>", current_connections);
|
||||
|
Loading…
Reference in New Issue
Block a user