FastAPI Queue
Project description
FastAPI queue
How to use
- Instance the class
Queue
withredis
instance andoptions
# queue_config.py
from fastapi_queue_task import Queue
from redis.asyncio.utils import from_url
redis = from_url(
f"redis://#REDIS_HOST:#REDIS_PORT/#REDIS_DATABASE_NAME",
encoding="utf-8",
decode_responses=True,
)
queue = Queue(redis, options={'concurrency': 10, 'max_attempt': 3})
queue.run()
- Add task to queue:
# mail_service.py
await queue.add_to_queue(name="TASK_NAME", data: Any = {})
How to test in testpypi
- Increase the version in
pyproject.toml
- Run command
$ . ./build_and_test.sh
How to publish new version
- Increase the version in
pyproject.toml
- Run command
$ . ./build_and_publish.sh
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for fastapi_queue_task-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 210f8eefa796e300256c12ba7f9267c0be51ac0b3d5b527725c9a3ae83b79d1e |
|
MD5 | 2770ed36618464755125deadacc2af86 |
|
BLAKE2b-256 | b9385118905411a265bf296889b26e1bc843a0d51880100d9aafa64eabae7b3e |