summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-11-06 14:13:51 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-11-06 14:13:51 +0100
commitefe149e5a08554d63a255e6cd03e952e21eddccd (patch)
treefba7f160a6614e90da032640ecdc7503140e41a9
parentyouporn fix (diff)
downloadpyload-efe149e5a08554d63a255e6cd03e952e21eddccd.tar.xz
cache fix
-rw-r--r--module/AccountManager.py13
-rw-r--r--module/gui/Accounts.py2
-rwxr-xr-xpyLoadCore.py10
3 files changed, 14 insertions, 11 deletions
diff --git a/module/AccountManager.py b/module/AccountManager.py
index 0409e5115..d1733585f 100644
--- a/module/AccountManager.py
+++ b/module/AccountManager.py
@@ -161,11 +161,13 @@ class AccountManager():
self.saveAccounts()
p.getAllAccounts(force=True)
- def getAccountInfos(self, force=False, cache=False):
+ def getCachedAccountInfos(self, refresh=True):
+ if refresh:
+ self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos)
+ return self.accountInfoCache
+
+ def getAccountInfos(self, force=True):
data = {}
- if cache:
- self.core.scheduler.addJob(0, self.core.accountManager.cacheAccountInfos) #prevent gui from blocking
- force = False
for p in self.accounts.keys():
if self.accounts[p]:
@@ -177,9 +179,6 @@ class AccountManager():
e = AccountUpdateEvent()
self.core.pullManager.addEvent(e)
return data
-
- def cacheAccountInfos(self):
- self.getAccountInfos(True, True)
def sendChange(self):
e = AccountUpdateEvent()
diff --git a/module/gui/Accounts.py b/module/gui/Accounts.py
index b83ce9827..ca559fcdb 100644
--- a/module/gui/Accounts.py
+++ b/module/gui/Accounts.py
@@ -31,7 +31,7 @@ class AccountModel(QAbstractItemModel):
self.mutex = QMutex()
def reloadData(self, force=True):
- data = self.connector.proxy.get_accounts(force)
+ data = self.connector.proxy.get_accounts(False, force)
self.beginRemoveRows(QModelIndex(), 0, len(self._data))
self._data = []
self.endRemoveRows()
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 04591d0b5..297bb8c59 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -314,7 +314,7 @@ class Core(object):
f = open(link_file, "wb")
f.close()
- self.scheduler.addJob(0, self.accountManager.cacheAccountInfos)
+ self.scheduler.addJob(0, self.accountManager.getAccountInfos)
while True:
sleep(2)
@@ -752,8 +752,12 @@ class ServerMethods():
def get_events(self, uuid):
return self.core.pullManager.getEvents(uuid)
- def get_accounts(self, refresh=False):
- return self.core.accountManager.getAccountInfos(force=refresh)
+ def get_accounts(self, force=False, refresh=True):
+ print force, refresh
+ if refresh:
+ return self.core.accountManager.getAccountInfos()
+ else:
+ return self.core.accountManager.getCachedAccountInfos(refresh)
def update_account(self, plugin, account, password=None, options={}):
""" create and update account """