dont open to many sessions

This commit is contained in:
j 2016-02-18 19:22:53 +05:30
parent 56d72cb887
commit 0f1cd9662d
1 changed files with 6 additions and 6 deletions

View File

@ -126,12 +126,12 @@ def run_scan():
remove_missing(books) remove_missing(books)
added = 0 added = 0
for f in ox.sorted_strings(books): with db.session():
if state.shutdown: for f in ox.sorted_strings(books):
return if state.shutdown:
if os.path.exists(f): break
id = media.get_id(f) if os.path.exists(f):
with db.session(): id = media.get_id(f)
file = File.get(id) file = File.get(id)
if not file: if not file:
file = add_file(id, f, prefix, f) file = add_file(id, f, prefix, f)