From: Max Kellermann Date: Thu, 10 Oct 2024 06:34:41 +0000 (+0200) Subject: common/Finisher: add method get_thread_name() X-Git-Tag: testing/wip-pdonnell-testing-20241019.005706-debug~1^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f4bc4be0fa812a042ec93d08987290fa40ae41b3;p=ceph-ci.git common/Finisher: add method get_thread_name() This allows eliminating the copy in `ActivePyModule`. Signed-off-by: Max Kellermann --- diff --git a/src/common/Finisher.h b/src/common/Finisher.h index c5c16052ff7..1a89f4289b7 100644 --- a/src/common/Finisher.h +++ b/src/common/Finisher.h @@ -113,6 +113,10 @@ class Finisher { bool is_empty(); + std::string_view get_thread_name() const noexcept { + return thread_name; + } + /// Construct an anonymous Finisher. /// Anonymous finishers do not log their queue length. explicit Finisher(CephContext *cct_); diff --git a/src/mgr/ActivePyModule.h b/src/mgr/ActivePyModule.h index 225a8edb4fc..8538f6e236a 100644 --- a/src/mgr/ActivePyModule.h +++ b/src/mgr/ActivePyModule.h @@ -48,7 +48,6 @@ private: std::string m_command_perms; const MgrSession* m_session = nullptr; - std::string fin_thread_name; public: Finisher finisher; // per active module finisher to execute commands @@ -56,8 +55,7 @@ public: ActivePyModule(const PyModuleRef &py_module_, LogChannelRef clog_) : PyModuleRunner(py_module_, clog_), - fin_thread_name(fmt::format("m-fin-{}", py_module->get_name()).substr(0,15)), - finisher(g_ceph_context, thread_name, fin_thread_name) + finisher(g_ceph_context, thread_name, fmt::format("m-fin-{}", py_module->get_name()).substr(0,15)) { } @@ -106,7 +104,7 @@ public: std::string_view get_fin_thread_name() const { - return fin_thread_name; + return finisher.get_thread_name(); } bool is_authorized(const std::map& arguments) const;