Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
416bae7d
Commit
416bae7d
authored
Mar 13, 2013
by
Michal 'vorner' Vaner
Browse files
[1927] Use barrier instead of sleep
It should be more reliable to ensure all messages arrived.
parent
c8b7d82c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/msgq/tests/msgq_run_test.py
View file @
416bae7d
...
...
@@ -235,11 +235,11 @@ class MsgqRunTest(unittest.TestCase):
self
.
assertTrue
(
lname
in
lnames
)
lnames
.
remove
(
lname
)
#
Wait a short time, so messages sent where they don't belong get som
e
#
time to arrive. They could still be late, so the test could still
#
pass on a slow machine, but an unreliable test is better than none
# at all. Any idea how to do it in a better way?
time
.
sleep
(
0.1
)
#
The barrier makes the msgq process everything we sent. As th
e
#
processing is single-threaded in it, any stray message would have
#
arrived before the barrier ends.
self
.
__barrier
(
conn_b
)
self
.
__barrier
([
conn_a
]
)
for
c
in
conn_b
:
self
.
assertEqual
((
None
,
None
),
c
.
group_recvmsg
())
self
.
assertEqual
((
None
,
None
),
conn_a
.
group_recvmsg
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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