mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 16:36:21 +02:00
Maint/asyncio (#305)
* Move to asyncio services, even though everything is largely sync
This commit is contained in:
parent
a0bf2362f6
commit
f350abb415
60 changed files with 243 additions and 227 deletions
|
|
@ -97,7 +97,7 @@ class Processor(ConsumerProducer):
|
|||
module=module,
|
||||
)
|
||||
|
||||
def handle(self, msg):
|
||||
async def handle(self, msg):
|
||||
|
||||
try:
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ class Processor(ConsumerProducer):
|
|||
|
||||
print("Send response...", flush=True)
|
||||
r = GraphRagResponse(response = response, error=None)
|
||||
self.producer.send(r, properties={"id": id})
|
||||
await self.send(r, properties={"id": id})
|
||||
|
||||
print("Done.", flush=True)
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ class Processor(ConsumerProducer):
|
|||
response=None,
|
||||
)
|
||||
|
||||
self.producer.send(r, properties={"id": id})
|
||||
await self.send(r, properties={"id": id})
|
||||
|
||||
self.consumer.acknowledge(msg)
|
||||
|
||||
|
|
@ -215,5 +215,5 @@ class Processor(ConsumerProducer):
|
|||
|
||||
def run():
|
||||
|
||||
Processor.start(module, __doc__)
|
||||
Processor.launch(module, __doc__)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue