Skip to main content

FastAPI Queue

Project description

FastAPI queue

How to use

  1. Instance the class Queue with redis instance and options
# 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()
  1. Add task to queue:
# mail_service.py
await queue.add_to_queue(name="TASK_NAME", data: Any = {})

How to test in testpypi

  1. Increase the version in pyproject.toml
  2. Run command
$ . ./build_and_test.sh

How to publish new version

  1. Increase the version in pyproject.toml
  2. 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

fastapi_queue_task-0.0.10.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

fastapi_queue_task-0.0.10-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_queue_task-0.0.10.tar.gz.

File metadata

  • Download URL: fastapi_queue_task-0.0.10.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for fastapi_queue_task-0.0.10.tar.gz
Algorithm Hash digest
SHA256 4f190be52c4c47278364e5abc9912f08bec535a4ff8a99c1d4730a5b80dbbcbe
MD5 c2931ee2004ff30425e517bd5707560d
BLAKE2b-256 867cbb9c10defc7718a3c0e57655cb8b360d2e732b8d92efad1bbccd15a0833c

See more details on using hashes here.

File details

Details for the file fastapi_queue_task-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_queue_task-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 060aa0e87d9d25ec2f8f762845c17e7205c754223e56117fb0ef3fe5dd8c10e9
MD5 bc838bf6f5753e42cc387db56d7ff026
BLAKE2b-256 2327539c92340a3f31ffadb5b6e20b6ed032464711c08455b301a177e8ce0daf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page