From c76299c5538b95ef74948e8809881564d25b96c1 Mon Sep 17 00:00:00 2001 From: John Cordeiro Date: Mon, 4 Sep 2023 17:39:26 -0300 Subject: [PATCH] Revert slow api issues once its not a problem anymore --- bothub_nlp_api/handlers/parse.py | 48 ++++++++++++++++---------------- entrypoint.sh | 3 +- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/bothub_nlp_api/handlers/parse.py b/bothub_nlp_api/handlers/parse.py index c79b465a..da8e8d75 100644 --- a/bothub_nlp_api/handlers/parse.py +++ b/bothub_nlp_api/handlers/parse.py @@ -120,29 +120,29 @@ def _parse( if "intent_ranking" not in answer or answer.get("intent_ranking") is None: answer.update({"intent_ranking": []}) - # log = threading.Thread( - # target=backend().send_log_nlp_parse, - # kwargs={ - # "data": { - # "text": text, - # "from_backend": from_backend, - # "user_agent": user_agent, - # "user": str(repository_authorization), - # "repository_version_language": int( - # repository.get("repository_version") - # ), - # "nlp_log": json.dumps(answer), - # "log_intent": [ - # { - # "intent": result["name"], - # "is_default": result["name"] == answer["intent"]["name"], - # "confidence": result["confidence"], - # } - # for result in answer.get("intent_ranking", []) - # ], - # } - # }, - # ) - # log.start() + log = threading.Thread( + target=backend().send_log_nlp_parse, + kwargs={ + "data": { + "text": text, + "from_backend": from_backend, + "user_agent": user_agent, + "user": str(repository_authorization), + "repository_version_language": int( + repository.get("repository_version") + ), + "nlp_log": json.dumps(answer), + "log_intent": [ + { + "intent": result["name"], + "is_default": result["name"] == answer["intent"]["name"], + "confidence": result["confidence"], + } + for result in answer.get("intent_ranking", []) + ], + } + }, + ) + log.start() return answer diff --git a/entrypoint.sh b/entrypoint.sh index 51d2e292..9e22f48e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,5 +2,4 @@ cd $WORKDIR #gunicorn bothub_nlp_api.wsgi --log-level debug --timeout 999999 -c gunicorn.conf.py -#gunicorn -k uvicorn.workers.UvicornWorker --timeout 999999 -c "gunicorn.conf.py" "bothub_nlp_api.app:app" -gunicorn -k uvicorn.workers.UvicornWorker --timeout 120 -c "gunicorn.conf.py" "bothub_nlp_api.app:app" +gunicorn -k uvicorn.workers.UvicornWorker --timeout 999999 -c "gunicorn.conf.py" "bothub_nlp_api.app:app"