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
11fdfd1e
Commit
11fdfd1e
authored
Jun 28, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a test race condition, I hope
parent
f9c5c35e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
17 deletions
+1
-17
src/ZEO/tests/ConnectionTests.py
src/ZEO/tests/ConnectionTests.py
+1
-17
No files found.
src/ZEO/tests/ConnectionTests.py
View file @
11fdfd1e
...
@@ -16,7 +16,6 @@ import contextlib
...
@@ -16,7 +16,6 @@ import contextlib
import
os
import
os
import
time
import
time
import
socket
import
socket
import
asyncore
import
threading
import
threading
import
logging
import
logging
...
@@ -192,31 +191,16 @@ class CommonSetupTearDown(StorageTestBase):
...
@@ -192,31 +191,16 @@ class CommonSetupTearDown(StorageTestBase):
def
pollUp
(
self
,
timeout
=
30.0
,
storage
=
None
):
def
pollUp
(
self
,
timeout
=
30.0
,
storage
=
None
):
if
storage
is
None
:
if
storage
is
None
:
storage
=
self
.
_storage
storage
=
self
.
_storage
# Poll until we're connected.
storage
.
server_status
()
now
=
time
.
time
()
giveup
=
now
+
timeout
while
not
storage
.
is_connected
():
asyncore
.
poll
(
0.1
)
now
=
time
.
time
()
if
now
>
giveup
:
self
.
fail
(
"timed out waiting for storage to connect"
)
# When the socket map is empty, poll() returns immediately,
# and this is a pure busy-loop then. At least on some Linux
# flavors, that can starve the thread trying to connect,
# leading to grossly increased runtime (typical) or bogus
# "timed out" failures. A little sleep here cures both.
time
.
sleep
(
0.1
)
def
pollDown
(
self
,
timeout
=
30.0
):
def
pollDown
(
self
,
timeout
=
30.0
):
# Poll until we're disconnected.
# Poll until we're disconnected.
now
=
time
.
time
()
now
=
time
.
time
()
giveup
=
now
+
timeout
giveup
=
now
+
timeout
while
self
.
_storage
.
is_connected
():
while
self
.
_storage
.
is_connected
():
asyncore
.
poll
(
0.1
)
now
=
time
.
time
()
now
=
time
.
time
()
if
now
>
giveup
:
if
now
>
giveup
:
self
.
fail
(
"timed out waiting for storage to disconnect"
)
self
.
fail
(
"timed out waiting for storage to disconnect"
)
# See pollUp() for why we sleep a little here.
time
.
sleep
(
0.1
)
time
.
sleep
(
0.1
)
...
...
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