diff --git a/src/query.rs b/src/query.rs index 8f429357..05f1391f 100644 --- a/src/query.rs +++ b/src/query.rs @@ -24,7 +24,7 @@ use crate::{ cancellation::CancellationToken, handlers::{into_handler, HandlerImpl}, key_expr::KeyExpr, - macros::{build, downcast_or_new, enum_mapper, option_wrapper, wrapper}, + macros::{build, downcast_or_new, enum_mapper, import, option_wrapper, wrapper}, matching::{MatchingListener, MatchingStatus}, qos::{CongestionControl, Priority}, sample::SourceInfo, @@ -144,11 +144,21 @@ impl Query { #[pyo3(from_py_with = ZBytes::from_py_opt)] attachment: Option, timestamp: Option, ) -> PyResult<()> { + if congestion_control.is_some() { + import!(py, warnings.warn).call1(( + "congestion_control in Query.reply is deprecated, it will be ignored", + py.get_type::(), + ))?; + } + if priority.is_some() { + import!(py, warnings.warn).call1(( + "priority in Query.reply is deprecated, it will be ignored", + py.get_type::(), + ))?; + } let build = build!( self.get_ref()?.reply(key_expr, payload), encoding, - congestion_control, - priority, express, attachment, timestamp, @@ -179,10 +189,20 @@ impl Query { #[pyo3(from_py_with = ZBytes::from_py_opt)] attachment: Option, timestamp: Option, ) -> PyResult<()> { + if congestion_control.is_some() { + import!(py, warnings.warn).call1(( + "congestion_control in Query.reply_del is deprecated, it will be ignored", + py.get_type::(), + ))?; + } + if priority.is_some() { + import!(py, warnings.warn).call1(( + "priority in Query.reply_del is deprecated, it will be ignored", + py.get_type::(), + ))?; + } let build = build!( self.get_ref()?.reply_del(key_expr), - congestion_control, - priority, express, attachment, timestamp, diff --git a/zenoh/__init__.pyi b/zenoh/__init__.pyi index 710644f9..29a73e67 100644 --- a/zenoh/__init__.pyi +++ b/zenoh/__init__.pyi @@ -853,6 +853,10 @@ class Query: .. note:: See the class documentation for important details about which key expression to use for replies. + + .. deprecated:: + The ``congestion_control`` and ``priority`` parameters are deprecated and will be ignored. + Response QoS now automatically matches the original query's QoS to avoid priority inversion. """ def reply_err(self, payload: _IntoZBytes, *, encoding: _IntoEncoding | None = None): @@ -874,6 +878,10 @@ class Query: .. note:: See the class documentation for important details about which key expression to use for replies. + + .. deprecated:: + The ``congestion_control`` and ``priority`` parameters are deprecated and will be ignored. + Response QoS now automatically matches the original query's QoS to avoid priority inversion. """ @_unstable