mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 12:52:12 +02:00
fix: ensure publisher is cleaned up on error in submit_document
If pub.send() raises an exception, pub.stop() was never called, leaking the publisher and its underlying connection. Wrap the pub.start()/pub.send() calls in try/finally so pub.stop() is always called, matching the existing pattern at lines 345-361. Fixes #871
This commit is contained in:
parent
1ffae12559
commit
ec56f69158
1 changed files with 7 additions and 6 deletions
|
|
@ -418,14 +418,15 @@ class Processor(AsyncProcessor):
|
|||
self.pubsub, q, schema=schema
|
||||
)
|
||||
|
||||
await pub.start()
|
||||
try:
|
||||
await pub.start()
|
||||
|
||||
# FIXME: Time wait kludge?
|
||||
await asyncio.sleep(1)
|
||||
# FIXME: Time wait kludge?
|
||||
await asyncio.sleep(1)
|
||||
|
||||
await pub.send(None, doc)
|
||||
|
||||
await pub.stop()
|
||||
await pub.send(None, doc)
|
||||
finally:
|
||||
await pub.stop()
|
||||
|
||||
logger.debug("Document submitted")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue