17 lines
495 B
Python
17 lines
495 B
Python
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())
|