Skip to content

Commit

Permalink
feat: broker -> **brokers
Browse files Browse the repository at this point in the history
  • Loading branch information
roma-frolov committed Dec 20, 2024
1 parent 1557674 commit a1d5719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions faststream/_internal/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def _init_setupable_( # noqa: PLW3201
self._setup()

def _setup(self) -> None:
if self.broker:
self.broker._setup(OuterBrokerState(di_state=self._state.di_state))
for broker in self.brokers:
broker._setup(OuterBrokerState(di_state=self._state.di_state))

async def _start_broker(self) -> None:
assert self.broker, "You should setup a broker"
Expand Down Expand Up @@ -272,7 +272,8 @@ async def _shutdown(self, log_level: int = logging.INFO) -> None:
async def stop(self) -> None:
"""Executes shutdown hooks and stop broker."""
async with self._shutdown_hooks_context():
await self.broker.close()
for broker in self.brokers:
await broker.close()

@asynccontextmanager
async def _shutdown_hooks_context(self) -> AsyncIterator[None]:
Expand Down
3 changes: 2 additions & 1 deletion faststream/_internal/cli/utils/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ def set_log_level(level: int, app: "Application") -> None:
if app.logger and getattr(app.logger, "setLevel", None):
app.logger.setLevel(level) # type: ignore[attr-defined]

app.broker._state.get().logger_state.set_level(level)
for broker in app.brokers:
broker._state.get().logger_state.set_level(level)

0 comments on commit a1d5719

Please sign in to comment.