production-evyos-systems-an.../ServicesTask/app/services/queue/queue_service_async.py

17 lines
495 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import asyncio
from services.service_base_async import ServiceBaseAsync
async def produce(service: ServiceBaseAsync):
fake_jobs = [{"action": "cleanup", "target": "old-tasks"}]
for job in fake_jobs:
await service.enqueue(job, "queue-maintenance")
async def consume(service: ServiceBaseAsync, job: dict):
print(f"[QUEUE CONTROL] İşleme alındı: {job}")
await asyncio.sleep(0.05)
if __name__ == "__main__":
asyncio.run(ServiceBaseAsync(produce, consume).run())