From 1b46c3422cce6543628bc1c6c2b20fce38bf04cb Mon Sep 17 00:00:00 2001 From: Alexander Kondratyev Date: Wed, 8 Mar 2017 00:42:16 +0300 Subject: [PATCH] Loading thread fix --- .gitignore | 4 +++- app/conf/uwsgi_zuykov.conf.template | 5 +++++ trademark/views.py | 5 ++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 53476e0..aa9e6ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ static/* *.pyc frontend/static/* -zsite/static/vendor/* \ No newline at end of file +zsite/static/vendor/* +_env/ +media/ \ No newline at end of file diff --git a/app/conf/uwsgi_zuykov.conf.template b/app/conf/uwsgi_zuykov.conf.template index ee234f4..65940f1 100644 --- a/app/conf/uwsgi_zuykov.conf.template +++ b/app/conf/uwsgi_zuykov.conf.template @@ -7,7 +7,12 @@ module = app.wsgi home = /home/%(SERVER_USERNAME)s/%(PROJECT_NAME)s/env eval = import newrelic.agent, wsgi; application = newrelic.agent.wsgi_application()(wsgi.application) +<<<<<<< HEAD master = false +======= +threads = 2 +master = true +>>>>>>> 71a93f4... loading fix processes = 4 socket = /home/%(SERVER_USERNAME)s/%(PROJECT_NAME)s/app/wsgi.sock chmod-socket = 666 diff --git a/trademark/views.py b/trademark/views.py index 628ec93..aae77cd 100644 --- a/trademark/views.py +++ b/trademark/views.py @@ -96,6 +96,7 @@ class SearchResultsThread(threading.Thread): loaded = False while not loaded: loaded = self.keyword.load_results() + time.sleep(5) class Search(generic.View): @@ -143,7 +144,7 @@ class Search(generic.View): else: return HttpResponse(json.dumps({ 'status': 'error', 'description': 'Empty request'}), content_type="application/json") - loading = SearchResultsThread(keyword=keyword) + loading = SearchResultsThread(keyword=k) loading.start() identity = k.searches.filter(similarity=146)[0] @@ -173,8 +174,6 @@ class Search(generic.View): 'status': 'ok' } - - return HttpResponse(json.dumps(response), content_type="application/json")