mirror of https://github.com/rq/rq.git
Restores compatibility with fakeredis (#1324)
This commit is contained in:
parent
f0afcd3cb3
commit
6028a63607
|
@ -18,6 +18,8 @@ import sys
|
|||
from collections import Iterable
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from redis.exceptions import ResponseError
|
||||
|
||||
from .compat import as_text, is_python_version, string_types
|
||||
from .exceptions import TimeoutFormatError
|
||||
|
||||
|
@ -251,8 +253,11 @@ def parse_timeout(timeout):
|
|||
|
||||
def get_version(connection):
|
||||
"""
|
||||
Return StrictVersion of Redis server version.
|
||||
Returns StrictVersion of Redis server version.
|
||||
This function also correctly handles 4 digit redis server versions.
|
||||
"""
|
||||
version_string = connection.info("server")["redis_version"]
|
||||
try:
|
||||
version_string = connection.info("server")["redis_version"]
|
||||
except ResponseError: # fakeredis doesn't implement Redis' INFO command
|
||||
version_string = "5.0.9"
|
||||
return StrictVersion('.'.join(version_string.split('.')[:3]))
|
Loading…
Reference in New Issue