Merge branch 'master' of github.com:rq/rq

This commit is contained in:
Selwin Ong 2020-08-21 09:31:25 +07:00
commit a09a2ab3b4
1 changed files with 8 additions and 3 deletions

View File

@ -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.
"""
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]))