From da7dcbaf32af0ee95df0e3a018df0f1b57036d5a Mon Sep 17 00:00:00 2001 From: Michael DeMarco Date: Fri, 29 Dec 2023 19:41:53 -0700 Subject: [PATCH] feat: add gevent --- Dockerfile | 2 +- bereal/server.py | 5 +++++ requirements/common.txt | 2 ++ requirements/prod.txt | 1 - 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6bd6be..84aac9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,4 @@ ENV FLASK_APP=bereal.server EXPOSE 5000 -CMD ["gunicorn", "-w", "4", "-t" "600", "bereal.server:app"] +CMD ["gunicorn", "-k", "gevent", "-w", "4", "-t" "600", "bereal.server:app"] diff --git a/bereal/server.py b/bereal/server.py index cb07452..e21f4aa 100644 --- a/bereal/server.py +++ b/bereal/server.py @@ -3,6 +3,11 @@ It contains the Flask app routing and the functions to interact with the BeReal API. """ +from gevent import monkey + +# TODO(michaelfromyeg): move +monkey.patch_all() + import os import warnings from datetime import datetime, timedelta diff --git a/requirements/common.txt b/requirements/common.txt index 497ad3c..6d34ee6 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -2,6 +2,8 @@ Flask==3.0.0 Flask-APScheduler==1.13.1 flask-cors==4.0.0 Flask-SQLAlchemy==3.1.1 +gevent==23.9.1 +gunicorn==21.2.0 librosa==0.10.1 moviepy==1.0.3 numpy==1.26.2 diff --git a/requirements/prod.txt b/requirements/prod.txt index a84db52..6624a30 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -1,2 +1 @@ -gunicorn -r common.txt