don't use notin_ with all items

This commit is contained in:
j 2016-02-12 23:12:19 +05:30
parent 37046903e0
commit c842c3ae90

View file

@ -313,15 +313,16 @@ def sync_db():
if sort_ids: if sort_ids:
t0 = time.time() t0 = time.time()
commit = False commit = False
for i in item.models.Item.query.filter(item.models.Item.id.notin_(sort_ids)): for i in item.models.Item.query:
i.update(commit=False) if i.id not in sort_ids:
if i.info['mediastate'] == 'unavailable' and state.tasks: i.update(commit=False)
state.tasks.queue('getpreview', i.id) if i.info['mediastate'] == 'unavailable' and state.tasks:
commit = True state.tasks.queue('getpreview', i.id)
#logger.debug('sync:%s', i) commit = True
t0 = maybe_commit(t0) #logger.debug('sync:%s', i)
if state.shutdown: t0 = maybe_commit(t0)
break if state.shutdown:
break
if commit: if commit:
state.db.session.commit() state.db.session.commit()
cleanup_lists() cleanup_lists()