fix: resolve publisher resource leak and field parse validation

This commit is contained in:
SahilYadav-op 2026-05-09 17:14:41 +05:30
parent 1ffae12559
commit acbecdc5a7
2 changed files with 8 additions and 11 deletions

View file

@ -29,8 +29,8 @@ class Field:
parts = defn.split(":")
if len(parts) == 0:
raise RuntimeError("Field definition cannot be empty")
if len(parts) > 5:
raise RuntimeError("Too many fields in definition")
if len(parts) == 1: parts.append("string")
if len(parts) == 2: parts.append("0")
@ -43,7 +43,7 @@ class Field:
try:
type = FieldType[type.upper()]
except:
except KeyError:
raise RuntimeError(f"Field type {type} is not known")
pri = True if pri == "pri" else False

View file

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