Fix publisher resource leak in librarian submit_document (#883)

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-08 20:22:48 +02:00 committed by GitHub
parent 1ffae12559
commit f9d6606423
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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