mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 12:52:12 +02:00
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:
parent
fe542b3d33
commit
81d9a84da4
1 changed files with 5 additions and 8 deletions
|
|
@ -450,14 +450,11 @@ class Processor(WorkspaceProcessor):
|
||||||
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")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue