Changeset 107337 in webkit
- Timestamp:
- Feb 9, 2012, 6:19:55 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Websites/webkit-perf.appspot.com/controller.py (modified) (6 diffs)
-
Websites/webkit-perf.appspot.com/models.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r107274 r107337 1 2012-02-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Perf-o-matic shouldn't rely on memcache to store cached JSON responses 4 https://bugs.webkit.org/show_bug.cgi?id=78306 5 6 Reviewed by Adam Barth. 7 8 Added PersistentCache model that stores the generated JSON responses. 9 10 * Websites/webkit-perf.appspot.com/controller.py: 11 (set_persistent_cache): 12 (set_persistent_cache.execute): 13 (get_persistent_cache): 14 (cache_manifest): 15 (CachedManifestHandler.get): 16 (cache_dashboard): 17 (CachedDashboardHandler.get): 18 (cache_runs): 19 (CachedRunsHandler.get): 20 * Websites/webkit-perf.appspot.com/models.py: 21 (TestResult): 22 (ReportLog): 23 (PersistentCache): 24 1 25 2012-02-09 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/Websites/webkit-perf.appspot.com/controller.py
r107274 r107337 31 31 from google.appengine.api import memcache 32 32 from google.appengine.api import taskqueue 33 from google.appengine.ext import db 33 34 34 35 from models import Test 36 from models import PersistentCache 37 38 39 def set_persistent_cache(name, value): 40 memcache.set(name, value) 41 42 def execute(): 43 cache = PersistentCache.get_by_key_name(name) 44 if cache: 45 cache.value = value 46 cache.put() 47 else: 48 PersistentCache(key_name=name, value=value).put() 49 50 db.run_in_transaction(execute) 51 52 53 def get_persistent_cache(name): 54 value = memcache.get(name) 55 if value: 56 return value 57 cache = PersistentCache.get_by_key_name(name) 58 memcache.set(name, cache) 59 return cache.value 35 60 36 61 37 62 def cache_manifest(cache): 38 memcache.set('manifest', cache)63 set_persistent_cache('manifest', cache) 39 64 40 65 … … 46 71 def get(self): 47 72 self.response.headers['Content-Type'] = 'application/json' 48 manifest = memcache.get('manifest')73 manifest = get_persistent_cache('manifest') 49 74 if manifest: 50 75 self.response.out.write(manifest) … … 54 79 55 80 def cache_dashboard(cache): 56 memcache.set('dashboard', cache)81 set_persistent_cache('dashboard', cache) 57 82 58 83 … … 64 89 def get(self): 65 90 self.response.headers['Content-Type'] = 'application/json' 66 dashboard = memcache.get('dashboard')91 dashboard = get_persistent_cache('dashboard') 67 92 if dashboard: 68 93 self.response.out.write(dashboard) … … 72 97 73 98 def cache_runs(test_id, branch_id, platform_id, cache): 74 memcache.set(Test.cache_key(test_id, branch_id, platform_id), cache)99 set_persistent_cache(Test.cache_key(test_id, branch_id, platform_id), cache) 75 100 76 101 … … 93 118 platform_id = 0 94 119 95 runs = memcache.get(Test.cache_key(test_id, branch_id, platform_id))120 runs = get_persistent_cache(Test.cache_key(test_id, branch_id, platform_id)) 96 121 if runs: 97 122 self.response.out.write(runs) -
trunk/Websites/webkit-perf.appspot.com/models.py
r106687 r107337 117 117 118 118 119 # Temporarily log reports sent by bots119 # Temporarily store log reports sent by bots 120 120 class ReportLog(db.Model): 121 121 timestamp = db.DateTimeProperty(required=True) 122 122 headers = db.TextProperty() 123 123 payload = db.TextProperty() 124 125 126 # Used when memcache entry is evicted 127 class PersistentCache(db.Model): 128 value = db.TextProperty(required=True)
Note:
See TracChangeset
for help on using the changeset viewer.