downloads can be accessed from tasks, start it earlier

This commit is contained in:
j 2016-02-18 12:15:15 +05:30
parent 9dda2f7303
commit 030563c933
2 changed files with 5 additions and 4 deletions

View file

@ -584,8 +584,9 @@ class Item(db.Model):
else:
self.added = None
self.update()
if self.id in state.downloads.transfers:
del state.downloads.transfers[self.id]
if state.downloads:
if self.id in state.downloads.transfers:
del state.downloads.transfers[self.id]
Changelog.record(user, 'removeitem', self.id)
class Sort(db.Model):

View file

@ -17,6 +17,7 @@ from item.icons import IconHandler
import db
import node.server
import oxtornado
import downloads
import settings
import setup
import state
@ -148,14 +149,12 @@ def run():
state.cache = Cache(ttl=60)
def start_node():
import downloads
import nodes
import tor
import bandwidth
state.bandwidth = bandwidth.Bandwidth()
state.tor = tor.Tor()
state.node = node.server.start()
state.downloads = downloads.Downloads()
state.nodes = nodes.Nodes()
def publish():
if not state.tor.is_online():
@ -166,6 +165,7 @@ def run():
state.main.call_later(10, lambda: state.tasks.queue('scanimport'))
if not state.update:
state.downloads = downloads.Downloads()
state.tasks = tasks.Tasks()
state.main.add_callback(start_node)
else: