fix shutdown if oml never went online

This commit is contained in:
j 2016-02-24 12:48:01 +05:30
parent c8722855e2
commit 130a900bb0

View file

@ -57,10 +57,10 @@ class Downloads(Thread):
def run(self):
self.wait(10)
while not state.shutdown:
self.wait_online()
with db.session():
self.download_next()
self.wait(10)
if self.wait_online():
with db.session():
self.download_next()
self.wait(10)
def join(self):
self.transfers.commit()
@ -68,8 +68,9 @@ class Downloads(Thread):
return Thread.join(self)
def wait_online(self):
while not state.online:
while not state.online and not state.shutdown:
self.wait(5)
return not state.shutdown
def wait(self, timeout):
step = min(timeout, 1)