Skip to content

Commit c01f96e

Browse files
committed
suppress service unavailable
1 parent 29db8f2 commit c01f96e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

faststream/nats/subscriber/usecases/stream_pull_subscriber.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import anyio
66
from nats.errors import ConnectionClosedError, TimeoutError
7+
from nats.js.errors import ServiceUnavailableError
78
from typing_extensions import override
89

910
from faststream._internal.endpoint.subscriber.mixins import ConcurrentMixin, TasksMixin
@@ -76,7 +77,7 @@ async def _consume_pull(
7677

7778
while self.running: # pragma: no branch
7879
messages = []
79-
with suppress(TimeoutError, ConnectionClosedError):
80+
with suppress(TimeoutError, ConnectionClosedError, ServiceUnavailableError):
8081
messages = await self.subscription.fetch(
8182
batch=self.pull_sub.batch_size,
8283
timeout=self.pull_sub.timeout,
@@ -224,7 +225,7 @@ async def _consume_pull(self) -> None:
224225
assert self.subscription, "You should call `create_subscription` at first."
225226

226227
while self.running: # pragma: no branch
227-
with suppress(TimeoutError, ConnectionClosedError):
228+
with suppress(TimeoutError, ConnectionClosedError, ServiceUnavailableError):
228229
messages = await self.subscription.fetch(
229230
batch=self.pull_sub.batch_size,
230231
timeout=self.pull_sub.timeout,

0 commit comments

Comments
 (0)