From 6371b338a62a97df0c6667c51ea627124d1d136d Mon Sep 17 00:00:00 2001 From: fuzzgun Date: Tue, 14 May 2013 17:32:10 +0100 Subject: [PATCH] Avoid an unnecessary query if there are no items in the messaging menu --- src/bitmessageqt/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 31c89ea6..d83c0fa4 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -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)