- python3.5
- aioredis (we only need
Redisobject with awaitable methods)
Redis object should be created before Queue init. This way you may use the
same connecton to Redis for different purposes in your program.
import asyncio
import aioredis
import aioredisqueue
loop = asyncio.get_event_loop()
async def process_jobs():
redis = await aioredis.create_reconnecting_redis(...)
queue = aioredisqueue.Queue(redis)
await q.put(b'abc')
task = await q.get()
print(task.payload)
await task.ack()
loop.run_until_complete(process_jobs)
All methods are coroutines, even get_nowait. That's because calls to redis are
performed during each such call.
loopmay be deleted from constructor params
- Task classes with built-in serialization support
max_itemslimit support: current version ofputmethod will be renamed intoput_nowait.get_multiandput_multimethods, allowing getting and putting multiple items from queue with one call- method for periodical requeueing of not acknowledged tasks
- keeping track of times a task was requeued, dropping too old tasks or tasks with too many retries.