From df450acd3dc735b4b930513007933d9aa2047fa4 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 19 Jan 2025 16:21:22 +1300 Subject: [PATCH] make dev environment avoid gevent monkey patching --- pyfedi.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pyfedi.py b/pyfedi.py index 47135a3f..d5140d98 100644 --- a/pyfedi.py +++ b/pyfedi.py @@ -1,11 +1,13 @@ # This file is part of pyfedi, which is licensed under the GNU General Public License (GPL) version 3.0. # You should have received a copy of the GPL along with this program. If not, see . +import os -from gevent import monkey -monkey.patch_all() +if os.environ.get('FLASK_ENV', '') != 'development': + from gevent import monkey + monkey.patch_all() -from psycogreen.gevent import patch_psycopg -patch_psycopg() + from psycogreen.gevent import patch_psycopg + patch_psycopg() from datetime import datetime @@ -13,7 +15,7 @@ from flask_babel import get_locale from flask_login import current_user from app import create_app, db, cli -import os, arrow +import arrow from flask import session, g, json, request, current_app from app.constants import POST_TYPE_LINK, POST_TYPE_IMAGE, POST_TYPE_ARTICLE, POST_TYPE_VIDEO, POST_TYPE_POLL, \ SUBSCRIPTION_MODERATOR, SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER, SUBSCRIPTION_PENDING