Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct rmq delayed handler router registration #691

Merged
merged 8 commits into from
Sep 21, 2023
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ The availability of such documentation significantly simplifies the integration

**FastStream** (thanks to [**FastDepend**](https://lancetnik.github.io/FastDepends/)) has a dependency management system similar to `pytest fixtures` and `FastAPI Depends` at the same time. Function arguments declare which dependencies you want are needed, and a special decorator delivers them from the global Context object.

```python linenums="1" hl_lines="9-10"
```python
from faststream import Depends, Logger

async def base_dep(user_id: int) -> bool:
return True

Expand Down
2 changes: 1 addition & 1 deletion faststream/__about__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Simple and fast framework to create message brokers based microservices"""
__version__ = "0.1.1rc0"
__version__ = "0.1.1"


INSTALL_YAML = """
Expand Down
8 changes: 5 additions & 3 deletions faststream/rabbit/shared/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ def __init__(
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
"""
for h in handlers:
q = RabbitQueue.validate(h.kwargs.pop("queue", h.args[0]))
new_q = model_copy(q, update={"name": prefix + q.name})
h.args = (new_q, *h.args[1:])
if (q := h.kwargs.pop("queue", None)) is None:
q, h.args = h.args[0], h.args[1:]
queue = RabbitQueue.validate(q)
new_q = model_copy(queue, update={"name": prefix + queue.name})
h.args = (new_q, *h.args)

super().__init__(prefix, handlers, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion tests/brokers/rabbit/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def response(m):
r_queue = RabbitQueue(queue)

r = type(router)(
prefix="test/", handlers=(self.route_class(response, r_queue),)
prefix="test/", handlers=(self.route_class(response, queue=r_queue),)
)

pub_broker.include_router(r)
Expand Down