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
b209919c
Commit
b209919c
authored
Sep 08, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make mutating thread daemonic and stop it if there is an error in the
test thread. Use with to simplify locking code.
parent
16fc41c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
28 deletions
+25
-28
src/ZEO/tests/invalidations_while_connecting.test
src/ZEO/tests/invalidations_while_connecting.test
+25
-28
No files found.
src/ZEO/tests/invalidations_while_connecting.test
View file @
b209919c
...
@@ -50,46 +50,43 @@ This tests tries to provoke this bug by:
...
@@ -50,46 +50,43 @@ This tests tries to provoke this bug by:
...
i
=
random
.
randint
(
0
,
nobs
-
1
)
...
i
=
random
.
randint
(
0
,
nobs
-
1
)
...
if
stop
:
...
if
stop
:
...
return
...
return
...
lock
.
acquire
()
...
with
lock
:
...
try
:
...
conn2
.
root
()[
i
]
.
value
+=
1
...
conn2
.
root
()[
i
]
.
value
+=
1
...
tm
.
commit
()
...
tm
.
commit
()
...
finally
:
...
time
.
sleep
(
0
)
...
lock
.
release
()
...
time
.
sleep
(
0
)
>>>
thread
=
threading
.
Thread
(
target
=
run
)
>>>
thread
=
threading
.
Thread
(
target
=
run
)
>>>
thread
.
setDaemon
(
True
)
>>>
thread
.
start
()
>>>
thread
.
start
()
-
restarting
the
first
client
,
and
-
restarting
the
first
client
,
and
-
testing
for
cache
validity
.
-
testing
for
cache
validity
.
>>>
import
zope
.
testing
.
loggingsupport
,
logging
>>>
import
zope
.
testing
.
loggingsupport
,
logging
>>>
handler
=
zope
.
testing
.
loggingsupport
.
InstalledHandler
(
>>>
handler
=
zope
.
testing
.
loggingsupport
.
InstalledHandler
(
...
'ZEO'
,
level
=
logging
.
ERROR
)
...
'ZEO'
,
level
=
logging
.
ERROR
)
>>>
for
c
in
range
(
10
)
:
>>>
try
:
...
time
.
sleep
(
.
1
)
...
for
c
in
range
(
10
)
:
...
db
=
ZODB
.
DB
(
ZEO
.
ClientStorage
.
ClientStorage
(
addr
,
client
=
'x'
)
)
...
time
.
sleep
(
.
1
)
...
_
=
lock
.
acquire
(
)
...
db
=
ZODB
.
DB
(
ZEO
.
ClientStorage
.
ClientStorage
(
addr
,
client
=
'x'
)
)
...
try
:
...
with
lock
:
...
wait_until
(
"connected and we've caught up"
,
...
@
wait_until
(
"connected and we've caught up"
,
timeout
=
199
)
...
lambda
:
...
def
_
()
:
...
db
.
storage
.
is_connected
()
...
return
(
db
.
storage
.
is_connected
()
...
and
db
.
storage
.
lastTransaction
()
...
and
db
.
storage
.
lastTransaction
()
...
==
db
.
storage
.
_server
.
lastTransaction
()
...
==
db
.
storage
.
_server
.
lastTransaction
()
...
)
...
)
...
...
...
conn
=
db
.
open
()
...
conn
=
db
.
open
()
...
for
i
in
range
(
1000
)
:
...
for
i
in
range
(
1000
)
:
...
if
conn
.
root
()[
i
]
.
value
!=
conn2
.
root
()[
i
]
.
value
:
...
if
conn
.
root
()[
i
]
.
value
!=
conn2
.
root
()[
i
]
.
value
:
...
print
'bad'
,
c
,
i
,
conn
.
root
()[
i
]
.
value
,
...
print
'bad'
,
c
,
i
,
conn
.
root
()[
i
]
.
value
,
...
print
conn2
.
root
()[
i
]
.
value
...
print
conn2
.
root
()[
i
]
.
value
...
finally
:
...
db
.
close
()
...
_
=
lock
.
release
()
...
finally
:
...
db
.
close
()
...
stop
=
True
...
thread
.
join
(
10
)
>>>
stop
=
True
>>>
thread
.
join
(
10
)
>>>
thread
.
isAlive
()
>>>
thread
.
isAlive
()
False
False
...
...
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