mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 04:42:11 +02:00
fix: ensure publisher cleanup on error in submit_document
Resolves #871 The submit_document method creates a Publisher but doesn't wrap the start/send calls in try/finally. If pub.send() raises, pub.stop() is never called and the publisher leaks. This matches the existing pattern in emit_document_provenance (line 345) which already uses try/finally correctly.
This commit is contained in:
parent
a943c4d4b6
commit
5e835c575e
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