Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -144,11 +144,21 @@ impl Query {
#[pyo3(from_py_with = ZBytes::from_py_opt)] attachment: Option<ZBytes>,
timestamp: Option<Timestamp>,
) -> 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::<pyo3::exceptions::PyDeprecationWarning>(),
))?;
}
if priority.is_some() {
import!(py, warnings.warn).call1((
"priority in Query.reply is deprecated, it will be ignored",
py.get_type::<pyo3::exceptions::PyDeprecationWarning>(),
))?;
}
let build = build!(
self.get_ref()?.reply(key_expr, payload),
encoding,
congestion_control,
priority,
express,
attachment,
timestamp,
Expand Down Expand Up @@ -179,10 +189,20 @@ impl Query {
#[pyo3(from_py_with = ZBytes::from_py_opt)] attachment: Option<ZBytes>,
timestamp: Option<Timestamp>,
) -> 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::<pyo3::exceptions::PyDeprecationWarning>(),
))?;
}
if priority.is_some() {
import!(py, warnings.warn).call1((
"priority in Query.reply_del is deprecated, it will be ignored",
py.get_type::<pyo3::exceptions::PyDeprecationWarning>(),
))?;
}
let build = build!(
self.get_ref()?.reply_del(key_expr),
congestion_control,
priority,
express,
attachment,
timestamp,
Expand Down
8 changes: 8 additions & 0 deletions zenoh/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
Loading