未验证 提交 96ca241f 编写于 作者: A alexey-milovidov 提交者: GitHub

Merge pull request #7158 from azat-archive/MetricsTransmitter-use-of-uninitialized-value

Avoid use of uninitialized values in MetricsTransmitter
......@@ -24,6 +24,8 @@ MetricsTransmitter::MetricsTransmitter(
send_events_cumulative = config.getBool(config_name + ".events_cumulative", false);
send_metrics = config.getBool(config_name + ".metrics", true);
send_asynchronous_metrics = config.getBool(config_name + ".asynchronous_metrics", true);
thread = ThreadFromGlobalPool{&MetricsTransmitter::run, this};
}
......@@ -38,7 +40,7 @@ MetricsTransmitter::~MetricsTransmitter()
cond.notify_one();
thread.join();
thread->join();
}
catch (...)
{
......
......@@ -5,8 +5,10 @@
#include <string>
#include <thread>
#include <vector>
#include <Common/ProfileEvents.h>
#include <optional>
#include <Core/Types.h>
#include <Common/ThreadPool.h>
#include <Common/ProfileEvents.h>
namespace Poco
......@@ -52,7 +54,7 @@ private:
bool quit = false;
std::mutex mutex;
std::condition_variable cond;
ThreadFromGlobalPool thread{&MetricsTransmitter::run, this};
std::optional<ThreadFromGlobalPool> thread;
static inline constexpr auto profile_events_path_prefix = "ClickHouse.ProfileEvents.";
static inline constexpr auto profile_events_cumulative_path_prefix = "ClickHouse.ProfileEventsCumulative.";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册