mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-24 14:07:03 +01:00
Remove message cleanup from webapp
This commit is contained in:
parent
c0798bd5b1
commit
1ac5ac3eeb
@ -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)
|
||||
|
@ -30,7 +30,7 @@
|
||||
<div class="col s12">
|
||||
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
|
||||
<h4>Run a Database Cleanup</h4>
|
||||
<p class="flow-text">Clears the keyval caches and purges the old messages. (Hit once, and wait a minute)</p>
|
||||
<p class="flow-text">Clears the keyval caches. (Hit once, and wait a minute)</p>
|
||||
<a class="waves-effect waves-light btn" id="db_cleanup_btn">Run DB Cleanup Task</a>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user