Skip to content

Commit

Permalink
fix: correct All Publisher middlewares order
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Nov 29, 2024
1 parent 8c3d2ea commit 797d888
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions faststream/confluent/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ async def request(
request: AsyncFunc = self._producer.request

for pub_m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
request = partial(pub_m, request)

Expand Down Expand Up @@ -198,11 +198,11 @@ async def publish(
call: AsyncFunc = self._producer.publish

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down Expand Up @@ -273,11 +273,11 @@ async def publish(
call: AsyncFunc = self._producer.publish_batch

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down
6 changes: 3 additions & 3 deletions faststream/kafka/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ async def request(
request: AsyncFunc = self._producer.request

for pub_m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
request = partial(pub_m, request)

Expand Down Expand Up @@ -299,11 +299,11 @@ async def publish(
call: AsyncFunc = self._producer.publish

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down Expand Up @@ -473,11 +473,11 @@ async def publish(
call: AsyncFunc = self._producer.publish_batch

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down
2 changes: 1 addition & 1 deletion faststream/nats/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ async def request(
request: AsyncFunc = self._producer.request

for pub_m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
request = partial(pub_m, request)

Expand Down
4 changes: 2 additions & 2 deletions faststream/rabbit/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ async def publish(
call: AsyncFunc = self._producer.publish

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down Expand Up @@ -349,11 +349,11 @@ async def request(
request: AsyncFunc = self._producer.request

for pub_m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
request = partial(pub_m, request)

Expand Down
14 changes: 7 additions & 7 deletions faststream/redis/publisher/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ async def publish(
call: AsyncFunc = self._producer.publish

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down Expand Up @@ -246,11 +246,11 @@ async def request(
request: AsyncFunc = self._producer.request

for pub_m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
request = partial(pub_m, request)

Expand Down Expand Up @@ -393,11 +393,11 @@ async def publish(
call: AsyncFunc = self._producer.publish

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down Expand Up @@ -460,11 +460,11 @@ async def request(
request: AsyncFunc = self._producer.request

for pub_m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
request = partial(pub_m, request)

Expand Down Expand Up @@ -524,11 +524,11 @@ async def publish( # type: ignore[override]
call: AsyncFunc = self._producer.publish_batch

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down Expand Up @@ -667,11 +667,11 @@ async def publish(
call: AsyncFunc = self._producer.publish

for m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
call = partial(m, call)

Expand Down Expand Up @@ -742,11 +742,11 @@ async def request(
request: AsyncFunc = self._producer.request

for pub_m in chain(
self._middlewares[::-1],
(
_extra_middlewares
or (m(None).publish_scope for m in self._broker_middlewares[::-1])
),
self._middlewares[::-1],
):
request = partial(pub_m, request)

Expand Down

0 comments on commit 797d888

Please sign in to comment.