summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-02 17:01:59 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-02 17:01:59 +0200
commit56754bcdbd15db520318a88ac779e1eb027853a8 (patch)
tree2d1a09b3fbe36eb6575e2ea757014b5c3d2dcb46
parentupload to fix (diff)
downloadpyload-56754bcdbd15db520318a88ac779e1eb027853a8.tar.xz
added several checks to improve stability
-rw-r--r--module/PluginThread.py3
-rw-r--r--module/ThreadManager.py12
-rw-r--r--module/database/DatabaseBackend.py21
-rw-r--r--module/database/FileDatabase.py4
-rwxr-xr-xpyLoadCore.py2
5 files changed, 37 insertions, 5 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index 6a8b98e6d..007a17ef1 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -143,6 +143,9 @@ class DownloadThread(PluginThread):
try:
+ if not hasattr(pyfile, "plugin"): continue
+ #this pyfile was deleted while queueing
+
pyfile.plugin.checkForSameFiles(starting=True)
self.m.log.info(_("Download starts: %s" % pyfile.name))
diff --git a/module/ThreadManager.py b/module/ThreadManager.py
index a8e8b2772..0a7408ecf 100644
--- a/module/ThreadManager.py
+++ b/module/ThreadManager.py
@@ -96,7 +96,17 @@ class ThreadManager:
if self.core.debug:
print_exc()
self.checkThreadCount()
- self.assignJob()
+
+ try:
+ self.assignJob()
+ except Exception, e:
+ self.log.warning("Assign job error", e)
+ if self.core.debug:
+ print_exc()
+
+ sleep(0.1)
+ self.assignJob()
+ #it may be failed non critical so we try it again
#----------------------------------------------------------------------
def tryReconnect(self):
diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py
index 95bb6a198..c147aa018 100644
--- a/module/database/DatabaseBackend.py
+++ b/module/database/DatabaseBackend.py
@@ -233,8 +233,27 @@ class DatabaseBackend(Thread):
self.c.executemany("INSERT INTO users(name, password, email) VALUES (?, ?, ?)", users)
move("pyload.db", "pyload.old.db")
-
+
+ #try to lower ids
+ self.c.execute('SELECT max(id) FROM LINKS')
+ fid = self.c.fetchone()[0]
+ if fid:
+ fid = int(fid)
+ else:
+ fid = 0
+ self.c.execute('UPDATE SQLITE_SEQUENCE SET seq=? WHERE name=?', (fid, "links"))
+
+
+ self.c.execute('SELECT max(id) FROM packages')
+ pid = self.c.fetchone()[0]
+ if pid:
+ pid = int(fid)
+ else:
+ pid = 0
+ self.c.execute('UPDATE SQLITE_SEQUENCE SET seq=? WHERE name=?', (pid, "packages"))
+
self.c.execute('VACUUM')
+
def createCursor(self):
return self.conn.cursor()
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py
index 3ba43f881..7ecf81576 100644
--- a/module/database/FileDatabase.py
+++ b/module/database/FileDatabase.py
@@ -96,7 +96,7 @@ class FileHandler:
self.db.syncSave()
- #----------------------------------------------------------------------
+ @lock
def getCompleteData(self, queue=1):
"""gets a complete data representation"""
@@ -112,7 +112,7 @@ class FileHandler:
return packs
- #----------------------------------------------------------------------
+ @lock
def getInfoData(self, queue=1):
"""gets a data representation without links"""
diff --git a/pyLoadCore.py b/pyLoadCore.py
index e8b024f4c..1bec0f7cc 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -550,7 +550,7 @@ class ServerMethods():
downloads = []
for pyfile in [x.active for x in self.core.threadManager.threads + self.core.threadManager.localThreads if
x.active and x.active != "quit"]:
- if not isinstance(pyfile, PyFile):
+ if not isinstance(pyfile, PyFile) or not hasattr(pyfile, "plugin"):
continue
download = {'id': pyfile.id,
'name': pyfile.name,