Fix publisher resource leak in librarian submit_document

Wrap pub.start()/pub.send() in try/finally to guarantee pub.stop() is
called on error. Remove unnecessary asyncio.sleep(1) kludge.
This commit is contained in:
gittihub-jpg 2026-05-07 15:57:38 +02:00
parent 1ffae12559
commit 9cf3dc29e4

View file

@ -418,14 +418,11 @@ class Processor(AsyncProcessor):
self.pubsub, q, schema=schema
)
await pub.start()
# FIXME: Time wait kludge?
await asyncio.sleep(1)
await pub.send(None, doc)
await pub.stop()
try:
await pub.start()
await pub.send(None, doc)
finally:
await pub.stop()
logger.debug("Document submitted")