Commit 6910c90f authored by ojan@chromium.org's avatar ojan@chromium.org

Make the rebaseline log server resilient to large logs.

Right now when it exceeds the appengine storage limit for a single
entry it 500s. Instead, just create a new entry. This isn't totally
ideal. Ideally we'd create a new entry but link it to the old
one so we can show it correctly in the UI, but that's too much work.

NOTRY=true
BUG=378490

Review URL: https://codereview.chromium.org/304303003

git-svn-id: svn://svn.chromium.org/blink/trunk@175230 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent be276b5b
......@@ -32,6 +32,7 @@ import webapp2
from google.appengine.ext import ndb
from google.appengine.ext.webapp import template
from google.appengine.ext.db import BadRequestError
# A simple log server for rebaseline-o-matic.
#
......@@ -100,7 +101,12 @@ class UpdateLog(webapp2.RequestHandler):
if new_entry or not log_entries:
log_entry = LogEntry(content=new_log_data, is_no_needs_rebaseline=no_needs_rebaseline)
log_entry.put()
try:
log_entry.put()
except BadRequestError:
out = "Created new log entry because the previous one exceeded the max length."
LogEntry(content=new_log_data, is_no_needs_rebaseline=no_needs_rebaseline).put()
self.response.out.write(out)
......
......@@ -71,6 +71,16 @@ class TestHandlers(unittest.TestCase):
self.assertEqual(response.status_int, 200)
self.assertEqual(response.body, 'Added to existing log entry.')
request = webapp2.Request.blank('/updatelog')
request.method = 'POST'
request.POST[main.LOG_PARAM] = 'x' * 1000000
request.POST[main.NEW_ENTRY_PARAM] = 'off'
request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off'
response = request.get_response(main.app)
self.assertEqual(response.status_int, 200)
self.assertEqual(response.body, 'Created new log entry because the previous one exceeded the max length.')
request = webapp2.Request.blank('/updatelog')
request.method = 'POST'
request.POST[main.LOG_PARAM] = 'data to log'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment