Cleanup db commit more often

Maybe this will fix the issue
This commit is contained in:
Jeremy "EndenDragon" Zhang 2017-06-24 10:48:47 -07:00 committed by GitHub
parent afc198363d
commit efcd2d9a83

View File

@ -470,6 +470,7 @@ def cleanup_keyval_db():
q = KeyValueProperties.query.filter(KeyValueProperties.expiration < datetime.datetime.now()).all() q = KeyValueProperties.query.filter(KeyValueProperties.expiration < datetime.datetime.now()).all()
for m in q: for m in q:
db.session.delete(m) db.session.delete(m)
db.session.commit()
guilds = Guilds.query.all() guilds = Guilds.query.all()
for guild in guilds: for guild in guilds:
@ -480,8 +481,8 @@ def cleanup_keyval_db():
for idx, val in enumerate(dbmsg): for idx, val in enumerate(dbmsg):
if len(dbmsg) - idx > 50: if len(dbmsg) - idx > 50:
db.session.delete(val) db.session.delete(val)
db.session.commit()
else: else:
continue continue
db.session.commit()
return ('', 204) return ('', 204)
abort(401) abort(401)