version 0.1.5, install as user to readme, more debug on filerequests, if upnpc fail try without -e, announce interval from 10 to 20 min, detect computer wakeup and acts as startup, delete sites files websocket command support, pause stop all current downloads, wrapper confirmation dialog support
This commit is contained in:
parent
3bec738595
commit
a977feec33
13 changed files with 197 additions and 16 deletions
|
@ -9,13 +9,14 @@ class WorkerManager:
|
|||
self.site = site
|
||||
self.workers = {} # Key: ip:port, Value: Worker.Worker
|
||||
self.tasks = [] # {"evt": evt, "workers_num": 0, "site": self.site, "inner_path": inner_path, "done": False, "time_started": None, "time_added": time.time(), "peers": peers, "priority": 0}
|
||||
self.running = True
|
||||
self.log = logging.getLogger("WorkerManager:%s" % self.site.address_short)
|
||||
self.process_taskchecker = gevent.spawn(self.checkTasks)
|
||||
|
||||
|
||||
# Check expired tasks
|
||||
def checkTasks(self):
|
||||
while 1:
|
||||
while self.running:
|
||||
time.sleep(15) # Check every 15 sec
|
||||
|
||||
# Clean up workers
|
||||
|
@ -42,6 +43,7 @@ class WorkerManager:
|
|||
task["peers"] = []
|
||||
self.startWorkers()
|
||||
break # One reannounce per loop
|
||||
self.log.debug("checkTasks stopped running")
|
||||
|
||||
|
||||
|
||||
|
@ -91,6 +93,16 @@ class WorkerManager:
|
|||
if worker: self.log.debug("Added worker: %s, workers: %s/%s" % (key, len(self.workers), MAX_WORKERS))
|
||||
|
||||
|
||||
# Stop all worker
|
||||
def stopWorkers(self):
|
||||
for worker in self.workers.values():
|
||||
worker.stop()
|
||||
tasks = self.tasks[:] # Copy
|
||||
for task in tasks: # Mark all current task as failed
|
||||
self.failTask(task)
|
||||
|
||||
|
||||
|
||||
# Find workers by task
|
||||
def findWorkers(self, task):
|
||||
workers = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue