WebBrowser/SafeBrowsing/SafeBrowsingCache.py

changeset 5853
e45a570528a4
parent 5847
fd1262c3fa79
child 6048
82ad8ec9548c
diff -r 3aad40446c29 -r e45a570528a4 WebBrowser/SafeBrowsing/SafeBrowsingCache.py
--- a/WebBrowser/SafeBrowsing/SafeBrowsingCache.py	Sun Aug 27 12:28:30 2017 +0200
+++ b/WebBrowser/SafeBrowsing/SafeBrowsingCache.py	Sun Aug 27 14:06:10 2017 +0200
@@ -182,6 +182,8 @@
     """
     drop_full_hash_value_idx = """DROP INDEX IF EXISTS idx_full_hash_value"""
     
+    maxProcessEventsTime = 500
+    
     def __init__(self, dbPath, parent=None):
         """
         Constructor
@@ -299,6 +301,8 @@
                     threatList = ThreatList(threatType, platformType,
                                             threatEntryType)
                     output.append((threatList, hasExpired))
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -343,6 +347,8 @@
                     threatList = ThreatList(threatType, platformType,
                                             threatEntryType)
                     output.append((threatList, fullHash, negativeCacheExpired))
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -520,6 +526,8 @@
                     threatList = ThreatList(threatType, platformType,
                                             threatEntryType)
                     output.append((threatList, clientState))
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -640,7 +648,8 @@
                 
                 while query.next():
                     sha256Hash.addData(query.value(0))
-                    QCoreApplication.processEvents(QEventLoop.AllEvents, 200)
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -680,6 +689,8 @@
                     query.addBindValue(threatList.threatEntryType)
                     query.exec_()
                     del query
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
             finally:
                 db.commit()
     
@@ -721,6 +732,8 @@
                         prefix = bytes(query.value(0))
                         output.append(prefix)
                     index += 1
+                    QCoreApplication.processEvents(QEventLoop.AllEvents,
+                                                   self.maxProcessEventsTime)
                 del query
             finally:
                 db.commit()
@@ -766,5 +779,7 @@
                                                QSql.In | QSql.Binary)
                         query.exec_()
                         del query
+                        QCoreApplication.processEvents(
+                            QEventLoop.AllEvents, self.maxProcessEventsTime)
                 finally:
                     db.commit()

eric ide

mercurial