Commit bfc54829 authored by Jeremy Kolbe's avatar Jeremy Kolbe

#165 more accurate asyncio.CancelledError handling

parent d5f63832
......@@ -10,6 +10,12 @@ Changelog
- Improve log message when client cache is out of sync with server.
See `issue 142 <https://github.com/zopefoundation/ZEO/issues/142>`_.
- Add support for Python 3.8 and Python 3.9.
- Add more accurate error handling for ``asyncio.CancelledError``.
See `issue 165 <https://github.com/zopefoundation/ZEO/issues/165>`_.
5.2.2 (2020-08-11)
------------------
......
......@@ -48,6 +48,8 @@ Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Database
......
......@@ -410,7 +410,10 @@ class Client(object):
def _clear_protocols(self, protocol=None):
for p in self.protocols:
if p is not protocol:
p.close()
try:
p.close()
except asyncio.CancelledError:
continue
self.protocols = ()
def disconnected(self, protocol=None):
......@@ -483,7 +486,14 @@ class Client(object):
protocol = self.protocol
if server_tid is None:
server_tid = yield protocol.fut('lastTransaction')
try:
server_tid = yield protocol.fut('lastTransaction')
except ClientDisconnected as exc:
# If needed, after consideration more exceptions can be
# caught here. Possibly you want to include this into the
# following try clause.
del self.protocol
self.register_failed(protocol, exc)
try:
cache = self.cache
......
......@@ -4,6 +4,8 @@ envlist =
py35
py36
py37
py38
py39
pypy
pypy3
simple
......@@ -67,6 +69,34 @@ deps =
{[testenv]deps}
uvloop
[testenv:py38-mtacceptor]
setenv =
ZEO_MTACCEPTOR=1
[testenv:py38-mtacceptor-msgpack1]
setenv =
ZEO_MTACCEPTOR=1
ZEO_MSGPACK=1
[testenv:py38-uvloop]
deps =
{[testenv]deps}
uvloop
[testenv:py39-mtacceptor]
setenv =
ZEO_MTACCEPTOR=1
[testenv:py39-mtacceptor-msgpack1]
setenv =
ZEO_MTACCEPTOR=1
ZEO_MSGPACK=1
[testenv:py39-uvloop]
deps =
{[testenv]deps}
uvloop
[testenv:pypy3-mtacceptor]
setenv =
ZEO_MTACCEPTOR=1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment