提交 c26e7c54 编写于 作者: A Andy McCurdy

make sure the selector is instantiated prior to cleaning it up

上级 8697007c
* 3.2.2 (in development)
* Cleanup the Connection's selector correctly. Thanks Bruce Merry. #1153
* 3.2.1
* Fix SentinelConnectionPool to work in multiprocess/forked environments.
* 3.2.0
......
......@@ -460,6 +460,7 @@ class Connection(object):
self.retry_on_timeout = retry_on_timeout
self.encoder = Encoder(encoding, encoding_errors, decode_responses)
self._sock = None
self._selector = None
self._parser = parser_class(socket_read_size=socket_read_size)
self._description_args = {
'host': self.host,
......@@ -581,8 +582,9 @@ class Connection(object):
self._parser.on_disconnect()
if self._sock is None:
return
self._selector.close()
self._selector = None
if self._selector is not None:
self._selector.close()
self._selector = None
try:
if os.getpid() == self.pid:
self._sock.shutdown(socket.SHUT_RDWR)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册