From c842c3ae90c03d0a73598629684e455f3cac22e4 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 12 Feb 2016 23:12:19 +0530 Subject: [PATCH] don't use notin_ with all items --- oml/library.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/oml/library.py b/oml/library.py index 752dad6..1da0abd 100644 --- a/oml/library.py +++ b/oml/library.py @@ -313,15 +313,16 @@ def sync_db(): if sort_ids: t0 = time.time() commit = False - for i in item.models.Item.query.filter(item.models.Item.id.notin_(sort_ids)): - i.update(commit=False) - if i.info['mediastate'] == 'unavailable' and state.tasks: - state.tasks.queue('getpreview', i.id) - commit = True - #logger.debug('sync:%s', i) - t0 = maybe_commit(t0) - if state.shutdown: - break + for i in item.models.Item.query: + if i.id not in sort_ids: + i.update(commit=False) + if i.info['mediastate'] == 'unavailable' and state.tasks: + state.tasks.queue('getpreview', i.id) + commit = True + #logger.debug('sync:%s', i) + t0 = maybe_commit(t0) + if state.shutdown: + break if commit: state.db.session.commit() cleanup_lists()