|
4 | 4 |
|
5 | 5 | import anyio |
6 | 6 | from nats.errors import ConnectionClosedError, TimeoutError |
| 7 | +from nats.js.errors import ServiceUnavailableError |
7 | 8 | from typing_extensions import override |
8 | 9 |
|
9 | 10 | from faststream._internal.endpoint.subscriber.mixins import ConcurrentMixin, TasksMixin |
@@ -76,7 +77,7 @@ async def _consume_pull( |
76 | 77 |
|
77 | 78 | while self.running: # pragma: no branch |
78 | 79 | messages = [] |
79 | | - with suppress(TimeoutError, ConnectionClosedError): |
| 80 | + with suppress(TimeoutError, ConnectionClosedError, ServiceUnavailableError): |
80 | 81 | messages = await self.subscription.fetch( |
81 | 82 | batch=self.pull_sub.batch_size, |
82 | 83 | timeout=self.pull_sub.timeout, |
@@ -224,7 +225,7 @@ async def _consume_pull(self) -> None: |
224 | 225 | assert self.subscription, "You should call `create_subscription` at first." |
225 | 226 |
|
226 | 227 | while self.running: # pragma: no branch |
227 | | - with suppress(TimeoutError, ConnectionClosedError): |
| 228 | + with suppress(TimeoutError, ConnectionClosedError, ServiceUnavailableError): |
228 | 229 | messages = await self.subscription.fetch( |
229 | 230 | batch=self.pull_sub.batch_size, |
230 | 231 | timeout=self.pull_sub.timeout, |
|
0 commit comments