Skip to content

Commit

Permalink
bruh, I need some rest for today
Browse files Browse the repository at this point in the history
Fix the silly mistake I made.
  • Loading branch information
MehmedGIT authored Mar 27, 2023
1 parent 7835154 commit 123366b
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 @@ -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:
Expand Down

0 comments on commit 123366b

Please sign in to comment.