Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

models.py: thread-safe cachedGeneratorG second attempt

  • Loading branch information...
commit 224ec51edc57b13e410753bc66094da840f242bb 1 parent d6cf1c3
Trey Smith trey0 authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 geocamTiePoint/models.py
4 geocamTiePoint/models.py
@@ -38,7 +38,6 @@
38 38 # use the memcached cache, but that would get rid of much of the benefit
39 39 # in terms of serialization/deserialization.
40 40 cachedGeneratorG = threading.local()
41   -cachedGeneratorG.gen = {'key': None, 'value': None}
42 41
43 42
44 43 def getNewImageFileName(instance, filename):
@@ -152,7 +151,8 @@ def getGeneratorCacheKey(cls, quadTreeId):
152 151 @classmethod
153 152 def getGeneratorWithCache(cls, quadTreeId):
154 153 global cachedGeneratorG
155   - cachedGeneratorCopy = cachedGeneratorG.gen
  154 + cachedGeneratorCopy = getattr(cachedGeneratorG, 'gen',
  155 + {'key': None, 'value': None})
156 156 key = cls.getGeneratorCacheKey(quadTreeId)
157 157 if cachedGeneratorCopy['key'] == key:
158 158 logging.debug('getGeneratorWithCache hit %s', key)

0 comments on commit 224ec51

Please sign in to comment.
Something went wrong with that request. Please try again.