Maint/asyncio (#305)

* Move to asyncio services, even though everything is largely sync
This commit is contained in:
cybermaggedon 2025-02-11 23:24:46 +00:00 committed by GitHub
parent a0bf2362f6
commit f350abb415
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 243 additions and 227 deletions

View file

@ -102,7 +102,7 @@ class Processor(ConsumerProducer):
print("Initialised", flush=True)
def handle(self, msg):
async def handle(self, msg):
v = msg.value()
@ -146,7 +146,7 @@ class Processor(ConsumerProducer):
out_token=outputtokens,
model=self.model
)
self.send(r, properties={"id": id})
await self.send(r, properties={"id": id})
print("Done.", flush=True)
@ -177,7 +177,7 @@ class Processor(ConsumerProducer):
model=None,
)
self.producer.send(r, properties={"id": id})
await self.send(r, properties={"id": id})
self.consumer.acknowledge(msg)
@ -217,6 +217,6 @@ class Processor(ConsumerProducer):
def run():
Processor.start(module, __doc__)
Processor.launch(module, __doc__)