Audit the number of SQL queries we make in writing manifests, and significantly reduce in the common case

Instead of 41 queries now for the simple manifest, we are down to 14.

The biggest changes:
  - Only synthesize the V1 image rows if we haven't already found them in the database
  - Thread the repository object through to the other model method calls, and use it instead of loading again and again
This commit is contained in:
Joseph Schorr 2018-01-11 16:25:38 -05:00
parent 4f47808e99
commit 9e16a989f5
8 changed files with 145 additions and 66 deletions

View file

@ -56,7 +56,7 @@ def gen_basic_auth(username, password):
def conduct_call(client, resource, url_for, method, params, body=None, expected_code=200,
headers=None):
headers=None, raw_body=None):
""" Conducts a call to a Flask endpoint. """
params = add_csrf_param(params)
@ -68,6 +68,9 @@ def conduct_call(client, resource, url_for, method, params, body=None, expected_
if body is not None:
body = json.dumps(body)
if raw_body is not None:
body = raw_body
# Required for anonymous calls to not exception.
g.identity = Identity(None, 'none')