Disable database automatic creation/migration in the sqlite middleware

The sqlite middleware is meant to serve existing databases. It's not
expected that we need to create a new database and make sure sql
migrations are up to date.
Disabling this yielded on non-scientific benchmarks an improvement on
the order of 300ms to 500ms being cut for the initial app bootstrap.

Change-Id: Iedcf3e7ef5181b6c6aa4275a2cfb23146994fe5b
This commit is contained in:
David Moreau Simard 2018-04-04 13:25:48 -04:00
parent b030fb097e
commit 05ea4528d3
1 changed files with 5 additions and 0 deletions

View File

@ -118,6 +118,11 @@ def application(environ, start_response):
# Path to the ARA database
os.environ['ARA_DATABASE'] = 'sqlite:///{}'.format(database)
# The intent is that we are dealing with databases that already exist.
# Therefore, we're not really interested in creating the database and
# making sure that the SQL migrations are done. Toggle that off.
# This needs to be a string, we're setting an environment variable
os.environ['ARA_AUTOCREATE_DATABASE'] = 'false'
from ara.webapp import create_app
try: