From 963aa245c80a297c93170bac2ae68fe5702c1aa4 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Wed, 24 Oct 2018 11:59:50 +0300 Subject: [PATCH] app.py: Don't initialize Solr connection We only need Solr in the indexing component, not for the API itself. --- app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index e2794c4..49f89f3 100644 --- a/app.py +++ b/app.py @@ -1,10 +1,8 @@ from database import database_connection import falcon -from solr import solr_connection db = database_connection() db.set_session(readonly=True) -solr = solr_connection() class AllItemsResource: def on_get(self, req, resp): @@ -65,6 +63,9 @@ class ItemResource: cursor.close() +def on_exit(api): + print("Shutting down DB") + api = falcon.API() api.add_route('/items', AllItemsResource()) api.add_route('/item/{item_id:int}', ItemResource())