one sqlalchemy session per thread

This commit is contained in:
j 2014-08-09 18:14:14 +02:00
commit 8b46a85d56
15 changed files with 140 additions and 102 deletions

View file

@ -6,6 +6,7 @@ from threading import Thread
import time
import logging
import db
import state
import settings
import update
@ -43,7 +44,7 @@ class Downloads(Thread):
def run(self):
time.sleep(2)
with self._app.app_context():
with db.session():
while self._running:
self.download_next()
time.sleep(0.5)