diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2019-06-01 08:38:01 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2019-07-09 17:03:36 -0700 |
commit | acac4db0c064d2618d75f27a58384c97c16458fd (patch) | |
tree | d06bbe03bb758c3cc443128d6046118146979240 /redis/_compat.py | |
parent | 9ed2132af28652e964b6a4a20d387580d1081003 (diff) | |
download | redis-py-acac4db0c064d2618d75f27a58384c97c16458fd.tar.gz |
Use nonblocking sockets instead of selectors for healthy connections
This replaces the work in 3.2.0 to use nonblocking sockets instead of
selectors. Selectors proved to be problematic for some environments
including eventlet and gevent. Nonblocking sockets should be available
in all environments.
Diffstat (limited to 'redis/_compat.py')
-rw-r--r-- | redis/_compat.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/redis/_compat.py b/redis/_compat.py index bde6fb6..d70af2a 100644 --- a/redis/_compat.py +++ b/redis/_compat.py @@ -1,12 +1,12 @@ """Internal module for Python 2 backwards compatibility.""" import errno +import socket import sys # For Python older than 3.5, retry EINTR. if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 5): # Adapted from https://bugs.python.org/review/23863/patch/14532/54418 - import socket import time # Wrapper for handling interruptable system calls. @@ -100,6 +100,7 @@ if sys.version_info[0] < 3: basestring = basestring unicode = unicode long = long + BlockingIOError = socket.error else: from urllib.parse import parse_qs, unquote, urlparse from string import ascii_letters @@ -129,6 +130,7 @@ else: unicode = str safe_unicode = str long = int + BlockingIOError = BlockingIOError try: # Python 3 from queue import LifoQueue, Empty, Full |