From 40417a13b2c140dd5e15ffa31bf2a80cbe72b018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anarthal=20=28Rub=C3=A9n=20P=C3=A9rez=29?= <34971811+anarthal@users.noreply.github.com> Date: Tue, 16 Sep 2025 00:49:33 +0200 Subject: [PATCH] Deprecates request::config::hello_with_priority (#305) --- include/boost/redis/impl/multiplexer.ipp | 2 +- include/boost/redis/request.hpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/boost/redis/impl/multiplexer.ipp b/include/boost/redis/impl/multiplexer.ipp index c77e2d86..12f900e3 100644 --- a/include/boost/redis/impl/multiplexer.ipp +++ b/include/boost/redis/impl/multiplexer.ipp @@ -67,7 +67,7 @@ void multiplexer::add(std::shared_ptr const& info) { reqs_.push_back(info); - if (info->get_request().has_hello_priority()) { + if (request_access::has_priority(info->get_request())) { auto rend = std::partition_point(std::rbegin(reqs_), std::rend(reqs_), [](auto const& e) { return e->is_waiting(); }); diff --git a/include/boost/redis/request.hpp b/include/boost/redis/request.hpp index 2cb041f4..a5873692 100644 --- a/include/boost/redis/request.hpp +++ b/include/boost/redis/request.hpp @@ -67,11 +67,17 @@ public: */ bool cancel_if_unresponded = true; - /** @brief If this request has a `HELLO` command and this flag + /** @brief (Deprecated) If this request has a `HELLO` command and this flag * is `true`, it will be moved to the * front of the queue of awaiting requests. This makes it * possible to send `HELLO` commands and authenticate before other * commands are sent. + * + * @par Deprecated + * This field has been superseded by @ref config::setup. + * This setup request will always be run first on connection establishment. + * Please use it to run any required setup commands. + * This field will be removed in subsequent releases. */ bool hello_with_priority = true; }; @@ -95,7 +101,11 @@ public: [[nodiscard]] auto payload() const noexcept -> std::string_view { return payload_; } - [[nodiscard]] auto has_hello_priority() const noexcept -> auto const& + [[nodiscard]] + BOOST_DEPRECATED( + "The hello_with_priority attribute and related functions are deprecated. " + "Use config::setup to run setup commands, instead.") auto has_hello_priority() const noexcept + -> auto const& { return has_hello_priority_; } @@ -341,6 +351,7 @@ namespace detail { struct request_access { inline static void set_priority(request& r, bool value) { r.has_hello_priority_ = value; } + inline static bool has_priority(const request& r) { return r.has_hello_priority_; } }; // Creates a HELLO 3 request