Network status updates
- only update processed numbers once every 2 seconds - moved inventory lookups to the main inventory so now all storage modules work with it
This commit is contained in:
parent
d9e3349eeb
commit
e522f015a8
|
@ -49,17 +49,17 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
|||
self.labelSyncStatus.setText(_translate("networkstatus", "Object(s) to be synced: %n", None, QtCore.QCoreApplication.CodecForTr, network.stats.pendingDownload() + network.stats.pendingUpload()))
|
||||
|
||||
def updateNumberOfMessagesProcessed(self):
|
||||
self.updateNumberOfObjectsToBeSynced()
|
||||
# self.updateNumberOfObjectsToBeSynced()
|
||||
self.labelMessageCount.setText(_translate(
|
||||
"networkstatus", "Processed %n person-to-person message(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfMessagesProcessed))
|
||||
|
||||
def updateNumberOfBroadcastsProcessed(self):
|
||||
self.updateNumberOfObjectsToBeSynced()
|
||||
# self.updateNumberOfObjectsToBeSynced()
|
||||
self.labelBroadcastCount.setText(_translate(
|
||||
"networkstatus", "Processed %n broadcast message(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfBroadcastsProcessed))
|
||||
|
||||
def updateNumberOfPubkeysProcessed(self):
|
||||
self.updateNumberOfObjectsToBeSynced()
|
||||
# self.updateNumberOfObjectsToBeSynced()
|
||||
self.labelPubkeyCount.setText(_translate(
|
||||
"networkstatus", "Processed %n public key(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfPubkeysProcessed))
|
||||
|
||||
|
@ -128,6 +128,9 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
|||
Inventory().numberOfInventoryLookupsPerformed = 0
|
||||
self.updateNumberOfBytes()
|
||||
self.updateNumberOfObjectsToBeSynced()
|
||||
self.updateNumberOfMessagesProcessed()
|
||||
self.updateNumberOfBroadcastsProcessed()
|
||||
self.updateNumberOfPubkeysProcessed()
|
||||
|
||||
def retranslateUi(self):
|
||||
super(QtGui.QWidget, self).retranslateUi()
|
||||
|
|
|
@ -23,10 +23,13 @@ class Inventory():
|
|||
self._className = "storage." + self._moduleName + "." + self._moduleName.title() + "Inventory"
|
||||
self._inventoryClass = eval(self._className)
|
||||
self._realInventory = self._inventoryClass()
|
||||
self.numberOfInventoryLookupsPerformed = 0
|
||||
|
||||
# cheap inheritance copied from asyncore
|
||||
def __getattr__(self, attr):
|
||||
try:
|
||||
if attr == "__contains__":
|
||||
self.numberOfInventoryLookupsPerformed += 1
|
||||
realRet = getattr(self._realInventory, attr)
|
||||
except AttributeError:
|
||||
raise AttributeError("%s instance has no attribute '%s'" %(self.__class__.__name__, attr))
|
||||
|
|
|
@ -15,7 +15,6 @@ class SqliteInventory(InventoryStorage):
|
|||
|
||||
def __contains__(self, hash):
|
||||
with self.lock:
|
||||
self.numberOfInventoryLookupsPerformed += 1
|
||||
if hash in self._inventory:
|
||||
return True
|
||||
return bool(sqlQuery('SELECT 1 FROM inventory WHERE hash=?', hash))
|
||||
|
|
Loading…
Reference in New Issue
Block a user