{"id":23380555,"url":"https://github.com/flix-tech/redis-tq","last_synced_at":"2025-08-01T12:06:10.703Z","repository":{"id":49905269,"uuid":"356228565","full_name":"flix-tech/redis-tq","owner":"flix-tech","description":"redis-based task queue written in Python","archived":false,"fork":false,"pushed_at":"2023-01-24T17:02:50.000Z","size":65,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T19:39:48.427Z","etag":null,"topics":["python","redis","task-queue"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flix-tech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-09T10:20:00.000Z","updated_at":"2023-10-13T06:56:49.000Z","dependencies_parsed_at":"2023-02-13T23:35:19.954Z","dependency_job_id":null,"html_url":"https://github.com/flix-tech/redis-tq","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fredis-tq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fredis-tq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fredis-tq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flix-tech%2Fredis-tq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flix-tech","download_url":"https://codeload.github.com/flix-tech/redis-tq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312190,"owners_count":21082637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","redis","task-queue"],"created_at":"2024-12-21T20:16:44.767Z","updated_at":"2025-04-10T22:44:04.113Z","avatar_url":"https://github.com/flix-tech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redis-tq\n\nredis-tq is a [Redis-based][redis] multi-producer, multi-consumer Queue.\nAllows for sharing data between multiple processes or hosts.\n\nTasks support a \"lease time\". After that time other workers may consider this\nclient to have crashed or stalled and pick up the item instead. The number of\nretries can be configured as well.\n\nBased on [this example][source] but with many improvements added.\n\n[source]: http://peter-hoffmann.com/2012/python-simple-queue-redis-queue.html\n[redis]: https://redis.io/\n\n\n## Installing\n\nredis-tq is available on [PyPI][] so you can simply install via:\n\n```sh\n$ pip install redis-tq\n```\n\n[PyPI]: https://pypi.org/project/redis-tq/\n\n\n## How to use\n\nOn the producing side, populate the queue with tasks and a respective lease\ntimeout:\n\n```python\nfrom redistq import TaskQueue\n\ntq = TaskQueue('localhost', 'myqueue')\nfor i in range(10):\n    tq.add(some task, lease_timeout, ttl=3)\n```\n\nOn the consuming side:\n\n```python\nfrom redistq import TaskQueue\n\ntq = TaskQueue('localhost', 'myqueue')\nwhile True:\n    task, task_id = tq.get()\n    if task is not None:\n        # do something with task and mark it as complete afterwards\n        tq.complete(task_id)\n    if tq.is_empty():\n        break\n    # tq.get is non-blocking, so you may want to sleep a\n    # bit before the next iteration\n    time.sleep(1)\n```\n\nIf the consumer crashes (i.e. the task is not marked as completed after\n`lease_timeout` seconds), the task will be put back into the task queue. This\nrescheduling will happen at most `ttl` times and then the task will be\ndropped. A callback can be provided if you want to monitor such cases.\n\n\n## Running the tests\n\nThe tests will check the presence of a Redis instance on localhost, you can\nuse\n\n    docker run --rm -d -p 6379:6379 redis\n\nto get one. Then use `make test`, it will take care of creating an appropriate\nvirtualenv and use it to run the tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflix-tech%2Fredis-tq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflix-tech%2Fredis-tq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflix-tech%2Fredis-tq/lists"}