fast shutdown if ids are still synced

This commit is contained in:
j 2016-02-24 12:24:36 +05:30
parent dc7ff544a7
commit 87be2e8aca

View file

@ -316,7 +316,7 @@ def sync_db():
if sort_ids:
t0 = time.time()
commit = False
for i in item.models.Item.query:
for i in item.models.Item.query.options(load_only('id')):
if i.id not in sort_ids:
i.update(commit=False)
if i.info['mediastate'] == 'unavailable' and state.tasks:
@ -328,7 +328,9 @@ def sync_db():
break
if commit:
state.db.session.commit()
if not state.shutdown:
cleanup_lists()
if not state.shutdown:
cleanup_peers()
def cleanup_lists():