From 42f16ab5f0e14b71cadd6ec8f2f37616f8adc5c1 Mon Sep 17 00:00:00 2001 From: mehmedGIT Date: Tue, 28 Mar 2023 12:08:44 +0200 Subject: [PATCH] Adapt the fix from #974 --- ocrd_network/ocrd_network/processing_server.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ocrd_network/ocrd_network/processing_server.py b/ocrd_network/ocrd_network/processing_server.py index 988480ee3..3e01c63e1 100644 --- a/ocrd_network/ocrd_network/processing_server.py +++ b/ocrd_network/ocrd_network/processing_server.py @@ -228,18 +228,17 @@ async def push_processor_job(self, processor_name: str, data: PYJobInput) -> PYJ if processor_name not in self.processor_list: try: - # Only checks if the process queue exists, if not raises ValueError + # Only checks if the process queue exists, if not raises ChannelClosedByBroker self.rmq_publisher.create_queue(processor_name, passive=True) except ChannelClosedByBroker as error: self.log.warning(f"Process queue with id '{processor_name}' not existing: {error}") + # Reconnect publisher - not efficient, but works + # TODO: Revisit when reconnection strategy is implemented + self.connect_publisher(enable_acks=True) raise HTTPException( status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=f"Process queue with id '{processor_name}' not existing" ) - finally: - # Reconnect publisher - not efficient, but works - # TODO: Revisit when reconnection strategy is implemented - self.connect_publisher(enable_acks=True) # validate additional parameters if data.parameters: