From 1ac5ac3eeb32cc9068371821e09d2a13198ec7f0 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Fri, 22 Sep 2017 00:59:37 +0000 Subject: [PATCH] Remove message cleanup from webapp --- webapp/titanembeds/blueprints/api/api.py | 12 ------------ webapp/titanembeds/templates/admin_index.html.j2 | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/webapp/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py index a5f474d..92cfcc5 100644 --- a/webapp/titanembeds/blueprints/api/api.py +++ b/webapp/titanembeds/blueprints/api/api.py @@ -435,17 +435,5 @@ def cleanup_keyval_db(): if canCleanupDB(): db.session.query(KeyValueProperties).filter(KeyValueProperties.expiration < datetime.datetime.now()).delete() db.session.commit() - - guilds = Guilds.query.all() - for guild in guilds: - try: - channelsjson = json.loads(guild.channels) - except: - continue - for channel in channelsjson: - chanid = channel["id"] - keep_these = db.session.query(Messages.id).filter(Messages.channel_id == chanid).order_by(Messages.timestamp.desc()).limit(50) - db.session.query(Messages).filter(Messages.channel_id == chanid, ~Messages.id.in_(keep_these)).delete(synchronize_session=False) - db.session.commit() return ('', 204) abort(401) diff --git a/webapp/titanembeds/templates/admin_index.html.j2 b/webapp/titanembeds/templates/admin_index.html.j2 index 55f76db..5201f37 100644 --- a/webapp/titanembeds/templates/admin_index.html.j2 +++ b/webapp/titanembeds/templates/admin_index.html.j2 @@ -30,7 +30,7 @@

Run a Database Cleanup

-

Clears the keyval caches and purges the old messages. (Hit once, and wait a minute)

+

Clears the keyval caches. (Hit once, and wait a minute)

Run DB Cleanup Task