Skip to content

Commit

Permalink
Fixed internal error on /_store/foo pages.
Browse files Browse the repository at this point in the history
The issue is caused by MemcacheMiddleware saving infobase store documents as
_store/foo and the same entry is looked up and attempted to use it as thing
when /_store/foo URL is visted.

Added to check to not use memcache when key starts with underscore.
  • Loading branch information
anandology committed Dec 26, 2014
1 parent 9d5b9ee commit 4e25d00
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openlibrary/plugins/openlibrary/connection.py
Expand Up @@ -275,6 +275,11 @@ def get_memcache(self, memcache_servers):
def get(self, sitename, data):
key = data.get('key')
revision = data.get('revision')

if key.startswith("_"):
# Don't cache keys that starts with _ to avoid considering _store/foo as things.
# The _store stuff is used for storing infobase store docs.
return ConnectionMiddleware.get(self, sitename, data)

if revision is None:
stats.begin("memcache.get", key=key)
Expand Down

0 comments on commit 4e25d00

Please sign in to comment.