Skip to content

Commit

Permalink
Support redis version 6 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wh1isper authored May 19, 2024
1 parent edbe5bc commit 37dc61b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
redis-version: ["6", "7"]

steps:
- uses: actions/checkout@v4
Expand All @@ -28,3 +29,5 @@ jobs:
- name: Test with pytest
run: |
pytest -vv --cov-config=.coveragerc --cov-report term-missing --cov=brq/ tests
env:
REDIS_VERSION: ${{ matrix.redis-version }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## Prerequisites

Redis >= 7, tested with latest docker image
Redis >= 6.2, tested with latest redis 6/7 docker image

## Install

Expand Down
3 changes: 3 additions & 0 deletions brq/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ async def _move_expired_jobs(self):
break

for message_id, serialized_job in expired_messages:
if message_id == serialized_job == None:
# Fix (None, None) for redis 6.x
continue
job = Job.from_message(serialized_job)
await self.redis.zadd(self.dead_key, {job.to_redis(): job.create_at})
logger.info(f"Put expired job {job} to dead queue")
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import socket
import time
from functools import partial
Expand Down Expand Up @@ -38,7 +39,7 @@ def redis_port(docker_client):
container = None
try:
container = docker_client.containers.run(
"redis",
f"redis:{os.getenv('REDIS_VERSION', '7')}",
detach=True,
ports={"6379": redis_port},
remove=True,
Expand Down

0 comments on commit 37dc61b

Please sign in to comment.