Skip to content

Commit b54d421

Browse files
authored
Merge pull request #65 from serv-c/drgroot-patch-1
fix(rabbitmq): just exit on fail
2 parents a439503 + 5bd4196 commit b54d421

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

servc/svc/com/bus/rabbitmq.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class BusRabbitMQ(BusComponent):
3737

3838
_conn: AsyncioConnection | BlockingConnection | None = None
3939

40-
_consumingArgs: Tuple[str, InputProcessor, OnConsuming | None, bool] | None = None
41-
4240
@property
4341
def isReady(self) -> bool:
4442
return (
@@ -83,15 +81,10 @@ def _close(self):
8381

8482
def on_connection_closed(self, _conn: AsyncioConnection, reason: pika.exceptions):
8583
if reason == pika.exceptions.StreamLostError:
84+
# Async connection always is impossible to reconstitute for some reason
8685
print(str(reason), flush=True)
8786
self._conn = None
88-
89-
# if this happens while consuming, then we need to re establish the on-consuming method
90-
if self._consumingArgs:
91-
route, inputProcessor, onConsuming, bindEventExchange = (
92-
self._consumingArgs
93-
)
94-
self.subscribe(route, inputProcessor, onConsuming, bindEventExchange)
87+
exit(1)
9588

9689
def get_channel(self, method: Callable | None, args: Tuple | None):
9790
if not self.isReady:
@@ -205,7 +198,6 @@ def subscribe( # type: ignore
205198
return self.get_channel(
206199
self.subscribe, (route, inputProcessor, onConsuming, bindEventExchange)
207200
)
208-
self._consumingArgs = (route, inputProcessor, onConsuming, bindEventExchange)
209201
channel.add_on_close_callback(lambda _c, _r: self.close())
210202
channel.add_on_cancel_callback(lambda _c: self.close())
211203

0 commit comments

Comments
 (0)