Skip to main content

Run tests and upload coverage codecov

Tailback

Tailback is a flexible, open-source, rate-limited queuing system. Based on the Leaky Bucket Algorithm, Tailback lets you create queues dynamically and update their rate limits in real time.

Features

  • Dynamic queues with no setup step.
  • Per-queue rate limits.
  • Live rate limit updates.
  • Automatic retries for unfinished jobs.
  • Simple queue metrics.
  • Async and sync Python support.

Requirements

  • Python 3.12+
  • Redis 7+ (run your own instance or start the bundled dev container)

Installation

From PyPI:

pip install tailback

From source (editable):

pip install -e .

Configuration

Tailback accepts a simple config mapping. Intervals are in milliseconds.

config = {
    "queue": {
        "key_prefix": "queue_server",
        "job_expire_interval": 5000,
        "job_requeue_interval": 5000,
        "default_job_requeue_limit": -1,  # -1 retries forever, 0 means no retries
    },
    "redis": {
        "db": 0,
        "conn_type": "tcp_sock",
        "host": "127.0.0.1",
        "port": 6379,
        "password": "",
        "clustered": False,
    },
}

For Unix socket connections, use conn_type: "unix_sock" and provide unix_socket_path:

"redis": {
    "db": 0,
    "conn_type": "unix_sock",
    "unix_socket_path": "/tmp/redis.sock",
    "password": "",
    "clustered": False,
}

If you use Unix sockets, uncomment the unixsocket lines in your redis.conf:

unixsocket /var/run/redis/redis.sock
unixsocketperm 755

Async Usage

Import Tailback from the top-level package:

from tailback import Tailback
import asyncio
import uuid
from tailback import Tailback


async def main():
    config = {
        "queue": {
            "key_prefix": "queue_server",
            "job_expire_interval": 5000,
            "job_requeue_interval": 5000,
            "default_job_requeue_limit": -1,
        },
        "redis": {
            "db": 0,
            "conn_type": "tcp_sock",
            "host": "127.0.0.1",
            "port": 6379,
            "password": "",
            "clustered": False,
        },
    }

    queue = Tailback(config)
    await queue.initialize()  # connect to Redis and register Lua scripts

    job_id = str(uuid.uuid4())
    await queue.enqueue(
        payload={"message": "hello, world"},
        interval=1000,            # ms between successful dequeues
        job_id=job_id,
        queue_id="user001",
        queue_type="sms",
    )

    job = await queue.dequeue(queue_type="sms")
    if job["status"] == "success":
        # ...process job["payload"]...
        await queue.finish(
            queue_type="sms",
            queue_id=job["queue_id"],
            job_id=job["job_id"],
        )

    await queue.close()


asyncio.run(main())

Sync Usage

Import Tailback from tailback.sync:

import uuid
from tailback.sync import Tailback


config = {
    "queue": {
        "key_prefix": "queue_server",
        "job_expire_interval": 5000,
        "job_requeue_interval": 5000,
        "default_job_requeue_limit": -1,
    },
    "redis": {
        "db": 0,
        "conn_type": "tcp_sock",
        "host": "127.0.0.1",
        "port": 6379,
        "password": "",
        "clustered": False,
    },
}

queue = Tailback(config)
queue.initialize()

job_id = str(uuid.uuid4())
queue.enqueue(
    payload={"message": "hello, world"},
    interval=1000,
    job_id=job_id,
    queue_id="user001",
    queue_type="sms",
)

job = queue.dequeue(queue_type="sms")
if job["status"] == "success":
    queue.finish(
        queue_type="sms",
        queue_id=job["queue_id"],
        job_id=job["job_id"],
    )

queue.close()

Common Operations

  • await queue.requeue() — move expired jobs back onto their queues.
  • await queue.interval(interval=5000, queue_id="user001", queue_type="sms") — change a queue’s rate limit on the fly.
  • await queue.metrics() — global metrics; pass queue_type and/or queue_id for scoped stats and queue length.
  • await queue.clear_queue(queue_type="sms", queue_id="user001", purge_all=True) — drop queued jobs and their payload/interval metadata.

The same operations are available from tailback.sync.Tailback without await.

Development

  • Start Redis for local development: make redis-up (binds to localhost:6379).
  • Run the suite: make test (automatically starts and tears down Redis).
  • Build a wheel: make build
  • Install/uninstall from the build: make install / make uninstall
  • Stop the dev Redis container: make redis-down

License

MIT — see LICENSE.txt.

Metadata

Release files for tailback 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tailback 1.0.0
File Size Uploaded Provenance Actions
tailback-1.0.0.tar.gz 15.3 kB With provenance Details for tailback-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tailback 1.0.0
File Interpreter ABI Platform Actions
tailback-1.0.0-py3-none-any.whl Python 3 none any Details for tailback-1.0.0-py3-none-any.whl

Total release size: 37.8 kB

Release files / tailback-1.0.0.tar.gz

Download URL tailback-1.0.0.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e4f7108628551e69a6164b8ddf59a284417a788048e21eaab965c96ce3e8bfd4
BLAKE2b-256 checksum
How to use checksums
8004df578a4fe610ee93f172026af203165f77899d24c81ac2fb90b0bc3e9090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / tailback-1.0.0-py3-none-any.whl

Download URL tailback-1.0.0-py3-none-any.whl
Size 22.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47eec173540d53c939ddf263cfe1be91f52da32e8e5ca60f894ae29491e66f67
BLAKE2b-256 checksum
How to use checksums
c038514917ef7505bcd19203c24dc62a278776a30d8391c1f837bbfbfbaf11ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Security for tailback 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tailback-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page