From a5c54449530aa558222a47354e7873b5203a3374 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 17 Mar 2011 14:13:05 +0100 Subject: closed #254 --- module/database/DatabaseBackend.py | 16 +++++++++------- module/database/FileDatabase.py | 4 ---- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'module/database') diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py index 02e09b3b3..9e9e73e43 100644 --- a/module/database/DatabaseBackend.py +++ b/module/database/DatabaseBackend.py @@ -16,8 +16,6 @@ @author: RaNaN @author: mkaay """ - -from threading import Lock from threading import Thread from threading import Event from os import remove @@ -97,7 +95,11 @@ class DatabaseJob(): try: self.result = self.f(*self.args, **self.kwargs) except Exception, e: - print "Database Error @", self.f.__name__, self.args[1:], self.kwargs, e + try: + print "Database Error @", self.f.__name__, self.args[1:], self.kwargs, e + except: + pass + print_exc() self.exception = e finally: @@ -147,10 +149,6 @@ class DatabaseBackend(Thread): self.conn.close() break j.processJob() - if j.exception: - self.conn.rollback() - else: - self.conn.commit() @style.queue def shutdown(self): @@ -259,6 +257,10 @@ class DatabaseBackend(Thread): @style.async def commit(self): self.conn.commit() + + @style.queue + def syncSave(self): + self.conn.commit() @style.async def rollback(self): diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py index 528bf666d..5c976eda4 100644 --- a/module/database/FileDatabase.py +++ b/module/database/FileDatabase.py @@ -756,10 +756,6 @@ class FileMethods(): def restartPackage(self, id): self.c.execute('UPDATE links SET status=3 WHERE package=?', (str(id),)) - @style.async - def syncSave(self): - self.commit() - @style.queue def getPackage(self, id): """return package instance from id""" -- cgit v1.2.3