diff --git a/files/routes/chats.py b/files/routes/chats.py index 1c8efcc21..b2456466c 100644 --- a/files/routes/chats.py +++ b/files/routes/chats.py @@ -9,6 +9,22 @@ from files.helpers.get import * from files.__main__ import app, limiter +@app.get("/retrofix") +@admin_level_required(5) +def chats_retrofix(v): + for chat in g.db.query(Chat).order_by(Chat.id): + if chat.id == 1: continue + owner_id = g.db.query(ChatMessage.user_id).filter_by(chat_id=chat.id).order_by(ChatMessage.created_utc).first() + print(chat.id, owner_id, flush=True) + if owner_id: + owner_id = owner_id[0] + membership = g.db.query(ChatMembership).filter_by(chat_id=chat.id, user_id=owner_id).one_or_none() + if membership: + membership.created_utc -= 1 + g.db.add(membership) + + return ('success') + @app.get("/chat") @app.get("/orgy") def chat_redirect(): diff --git a/gunicorn.conf.py b/gunicorn.conf.py index dccae1a94..6ab71f315 100644 --- a/gunicorn.conf.py +++ b/gunicorn.conf.py @@ -6,7 +6,7 @@ bind = '0.0.0.0:5000' worker_class = 'gevent' workers = int(environ.get("WORKER_COUNT").strip()) - +timeout = 120 max_requests = 5000 max_requests_jitter = 10000