Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
b79c7216
Commit
b79c7216
authored
May 26, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If we time out on call (or initial connect) because we're disconnected, raiser ClientDisconnected.
parent
f656c5b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
src/ZEO/asyncio/client.py
src/ZEO/asyncio/client.py
+8
-2
src/ZEO/asyncio/tests.py
src/ZEO/asyncio/tests.py
+9
-1
No files found.
src/ZEO/asyncio/client.py
View file @
b79c7216
...
...
@@ -679,7 +679,13 @@ class ClientRunner:
self
.
connected
.
set_result
(
None
)
def
wait_for_result
(
self
,
future
,
timeout
):
return
future
.
result
(
self
.
timeout
if
timeout
is
False
else
timeout
)
try
:
return
future
.
result
(
self
.
timeout
if
timeout
is
False
else
timeout
)
except
concurrent
.
futures
.
TimeoutError
:
if
not
self
.
client
.
ready
:
raise
ClientDisconnected
(
"timed out waiting for connection"
)
else
:
raise
def
call
(
self
,
method
,
*
args
,
timeout
=
None
):
return
self
.
__call
(
self
.
call_threadsafe
,
method
,
args
)
...
...
@@ -781,7 +787,7 @@ class ClientThread(ClientRunner):
if
self
.
exception
:
raise
self
.
exception
if
wait
:
self
.
connected
.
result
(
self
.
timeout
)
self
.
wait_for_result
(
self
.
connected
,
self
.
timeout
)
closed
=
False
def
close
(
self
):
...
...
src/ZEO/asyncio/tests.py
View file @
b79c7216
...
...
@@ -28,7 +28,7 @@ class AsyncTests(setupstack.TestCase, ClientRunner):
wrapper
=
mock
.
Mock
()
cache
=
MemoryCache
()
self
.
set_options
(
addrs
,
wrapper
,
cache
,
'TEST'
,
read_only
)
self
.
set_options
(
addrs
,
wrapper
,
cache
,
'TEST'
,
read_only
,
timeout
=
1
)
# We can also provide an event loop. We'll use a testing loop
# so we don't have to actually make any network connection.
...
...
@@ -604,6 +604,14 @@ class AsyncTests(setupstack.TestCase, ClientRunner):
client
.
call_async_from_same_thread
(
'foo'
,
1
)
self
.
assertEqual
(
self
.
parse
(
transport
.
pop
()),
(
0
,
True
,
'foo'
,
(
1
,
)))
def
test_ClientDisconnected_on_call_timeout
(
self
):
wrapper
,
cache
,
loop
,
client
,
protocol
,
transport
,
send
,
respond
=
(
self
.
start
())
self
.
wait_for_result
=
super
().
wait_for_result
self
.
assertRaises
(
ClientDisconnected
,
self
.
call
,
'foo'
)
client
.
ready
=
False
self
.
assertRaises
(
ClientDisconnected
,
self
.
call
,
'foo'
)
def
unsized
(
self
,
data
,
unpickle
=
False
):
result
=
[]
while
data
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment