mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-08 21:02:12 +02:00
fix: resolve publisher resource leak and field parse validation
This commit is contained in:
parent
1ffae12559
commit
acbecdc5a7
2 changed files with 8 additions and 11 deletions
|
|
@ -29,8 +29,8 @@ class Field:
|
||||||
|
|
||||||
parts = defn.split(":")
|
parts = defn.split(":")
|
||||||
|
|
||||||
if len(parts) == 0:
|
if len(parts) > 5:
|
||||||
raise RuntimeError("Field definition cannot be empty")
|
raise RuntimeError("Too many fields in definition")
|
||||||
|
|
||||||
if len(parts) == 1: parts.append("string")
|
if len(parts) == 1: parts.append("string")
|
||||||
if len(parts) == 2: parts.append("0")
|
if len(parts) == 2: parts.append("0")
|
||||||
|
|
@ -43,7 +43,7 @@ class Field:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
type = FieldType[type.upper()]
|
type = FieldType[type.upper()]
|
||||||
except:
|
except KeyError:
|
||||||
raise RuntimeError(f"Field type {type} is not known")
|
raise RuntimeError(f"Field type {type} is not known")
|
||||||
|
|
||||||
pri = True if pri == "pri" else False
|
pri = True if pri == "pri" else False
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue