Skip to content

Commit

Permalink
merge from #974
Browse files Browse the repository at this point in the history
  • Loading branch information
MehmedGIT committed Mar 28, 2023
2 parents 1a6362a + 123366b commit 51993fb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ocrd_network/ocrd_network/processing_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,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:
Expand Down

0 comments on commit 51993fb

Please sign in to comment.