Skip to content

Commit

Permalink
fix: cast redis server version from float to str (#2025)
Browse files Browse the repository at this point in the history
Currently, with Redis engine 7.1, and `redis` client 5.0.1 trying to enqueue a new job yields

```text
AttributeError: 'float' object has no attribute 'split'
```

This is caused by the fact that `redis_conn.info("server")["redis_version"]` returns a `float`, not a `str`.
  • Loading branch information
peter-gy committed Jan 19, 2024
1 parent e2b600d commit 2f5fecc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def get_version(connection: 'Redis') -> Tuple[int, int, int]:
setattr(
connection,
"__rq_redis_server_version",
tuple(int(i) for i in connection.info("server")["redis_version"].split('.')[:3]),
tuple(int(i) for i in str(connection.info("server")["redis_version"]).split('.')[:3]),
)
return getattr(connection, "__rq_redis_server_version")
except ResponseError: # fakeredis doesn't implement Redis' INFO command
Expand Down

0 comments on commit 2f5fecc

Please sign in to comment.