Avoid an unnecessary query if there are no items in the messaging menu

This commit is contained in:
fuzzgun 2013-05-14 17:32:10 +01:00
parent f0a2c65b2e
commit 6371b338a6
1 changed files with 5 additions and 0 deletions

View File

@ -626,6 +626,11 @@ class MyForm(QtGui.QMainWindow):
if not withMessagingMenu:
return
# if there are no items on the messaging menu then
# the subsequent query can be avoided
if not (self.mmapp.has_source("Subscriptions") or self.mmapp.has_source("Messages")):
return
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT toaddress, read FROM inbox WHERE msgid=?''')
shared.sqlSubmitQueue.put(inventoryHash)