dont open to many sessions

This commit is contained in:
j 2016-02-18 19:22:53 +05:30
parent 56d72cb887
commit 0f1cd9662d

View file

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