Skip to content

Commit

Permalink
Work around a beneficial race
Browse files Browse the repository at this point in the history
When data are loaded, we notify waiting code before updating the cache.

This can confuse white-box tests that make assertions about the client
cache after a load, because the cache change may or may not have been
made yet.
  • Loading branch information
Jim Fulton committed Oct 26, 2016
1 parent 11eb9fd commit 184750c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/ZEO/tests/drop_cache_rather_than_verify.txt
Expand Up @@ -114,9 +114,6 @@ If we access the root object, it'll be loaded from the server:
>>> conn.root()[1].x
6

>>> len(db.storage._cache)
2

Similarly, if we simply disconnect the client, and write data from
another client:

Expand All @@ -138,8 +135,8 @@ another client:
- Drops or clears it's client cache. (The end result is that the cache
is working but empty.)

>>> len(db.storage._cache)
1
>>> len(db.storage._cache) <= 1
True

(When a database is created, it checks to make sure the root object is
in the database, which is why we get 1, rather than 0 objects in the cache.)
Expand Down

0 comments on commit 184750c

Please sign in to comment.