cleanup sort/find table

This commit is contained in:
j 2016-02-27 11:21:12 +05:30
parent be1c4085f2
commit 54f301ff71
2 changed files with 4 additions and 0 deletions

View File

@ -105,6 +105,8 @@ class Item(db.Model):
Sort.query.filter(Sort.item_id.in_(ids)).delete(synchronize_session=False)
cls.query.filter(cls.id.in_(ids)).delete(synchronize_session=False)
state.db.session.expire_all()
Sort.query.filter_by(item_id=None).delete()
Find.query.filter_by(item_id=None).delete()
@classmethod
def remove_without_user(cls):

View File

@ -340,6 +340,8 @@ def sync_db():
if not state.shutdown:
cleanup_peers()
logger.debug('peers cleaned up')
item.models.Sort.query.filter_by(item_id=None).delete()
item.models.Find.query.filter_by(item_id=None).delete()
def cleanup_lists():
import item.models