Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: Tools/GardeningServer/alerts.py

Issue 657533002: Decreased num alerts in history per page to 5 to avoid exceed memory and response limit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import calendar 5 import calendar
6 import datetime 6 import datetime
7 import json 7 import json
8 import logging 8 import logging
9 import webapp2 9 import webapp2
10 import zlib 10 import zlib
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 alerts = self.parse_alerts(self.request.get('content')) 105 alerts = self.parse_alerts(self.request.get('content'))
106 if alerts: 106 if alerts:
107 self.post_to_memcache(alerts_type, alerts) 107 self.post_to_memcache(alerts_type, alerts)
108 self.post_to_history(alerts_type, alerts) 108 self.post_to_history(alerts_type, alerts)
109 109
110 def post(self): 110 def post(self):
111 self.update_alerts(AlertsHandler.ALERTS_TYPE) 111 self.update_alerts(AlertsHandler.ALERTS_TYPE)
112 112
113 113
114 class AlertsHistory(webapp2.RequestHandler): 114 class AlertsHistory(webapp2.RequestHandler):
115 MAX_LIMIT_PER_PAGE = 50 115 MAX_LIMIT_PER_PAGE = 5
116 116
117 def get(self): 117 def get(self):
118 alerts_query = AlertsJSON.query().order(-AlertsJSON.date) 118 alerts_query = AlertsJSON.query().order(-AlertsJSON.date)
119 result_json = {} 119 result_json = {}
120 120
121 user = users.get_current_user() 121 user = users.get_current_user()
122 if not user: 122 if not user:
123 result_json['redirect-url'] = users.create_login_url( 123 result_json['redirect-url'] = users.create_login_url(
124 self.request.uri) 124 self.request.uri)
125 125
(...skipping 22 matching lines...) Expand all
148 }) 148 })
149 149
150 self.response.headers['Content-Type'] = 'application/json' 150 self.response.headers['Content-Type'] = 'application/json'
151 self.response.out.write(json.dumps(result_json)) 151 self.response.out.write(json.dumps(result_json))
152 152
153 153
154 app = webapp2.WSGIApplication([ 154 app = webapp2.WSGIApplication([
155 ('/alerts', AlertsHandler), 155 ('/alerts', AlertsHandler),
156 ('/alerts-history', AlertsHistory) 156 ('/alerts-history', AlertsHistory)
157 ]) 157 ])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698