disable counts for regex queries, it is performance killer sadly
This commit is contained in:
parent
741d1b2b45
commit
a4f3786e01
@ -84,27 +84,10 @@ bool Search::deleteViaGui() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Search::updateCounts(bool including_total_count) {
|
void Search::updateCounts(bool including_total_count) {
|
||||||
QSqlDatabase database = qApp->database()->driver()->threadSafeConnection(metaObject()->className());
|
Q_UNUSED(including_total_count)
|
||||||
int account_id = getParentServiceRoot()->accountId();
|
|
||||||
|
|
||||||
try {
|
setCountOfAllMessages(-1);
|
||||||
auto ac = DatabaseQueries::getMessageCountsForProbe(database, this, account_id);
|
setCountOfUnreadMessages(-1);
|
||||||
|
|
||||||
if (including_total_count) {
|
|
||||||
setCountOfAllMessages(ac.m_total);
|
|
||||||
}
|
|
||||||
|
|
||||||
setCountOfUnreadMessages(ac.m_unread);
|
|
||||||
}
|
|
||||||
catch (const ApplicationException& ex) {
|
|
||||||
qCriticalNN << LOGSEC_CORE << "Failed to get counts of probe:" << QUOTE_W_SPACE_DOT(ex.message());
|
|
||||||
|
|
||||||
if (including_total_count) {
|
|
||||||
setCountOfAllMessages(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
setCountOfUnreadMessages(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> Search::undeletedMessages() const {
|
QList<Message> Search::undeletedMessages() const {
|
||||||
|
@ -60,27 +60,6 @@ QList<QAction*> SearchsNode::contextMenuFeedsList() {
|
|||||||
return QList<QAction*>{m_actProbeNew};
|
return QList<QAction*>{m_actProbeNew};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchsNode::updateCounts(bool including_total_count) {
|
|
||||||
Q_UNUSED(including_total_count)
|
|
||||||
|
|
||||||
// NOTE: We do not update all counts here because it is simply taking too much time.
|
|
||||||
// This is true when user has many regex queries added because SQLite (MariaDB) simply
|
|
||||||
// takes too long to finish SQL queries with REGEXPs.
|
|
||||||
//
|
|
||||||
// We only update one by one.
|
|
||||||
if (childCount() <= 10) {
|
|
||||||
RootItem::updateCounts(including_total_count);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (RootItem* child : qAsConst(childItems())) {
|
|
||||||
auto* sear = qobject_cast<Search*>(child);
|
|
||||||
|
|
||||||
sear->setCountOfAllMessages(-1);
|
|
||||||
sear->setCountOfUnreadMessages(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SearchsNode::createProbe() {
|
void SearchsNode::createProbe() {
|
||||||
FormAddEditProbe frm(qApp->mainFormWidget());
|
FormAddEditProbe frm(qApp->mainFormWidget());
|
||||||
Search* new_prb = frm.execForAdd();
|
Search* new_prb = frm.execForAdd();
|
||||||
|
@ -18,7 +18,6 @@ class SearchsNode : public RootItem {
|
|||||||
|
|
||||||
virtual QList<Message> undeletedMessages() const;
|
virtual QList<Message> undeletedMessages() const;
|
||||||
virtual QList<QAction*> contextMenuFeedsList();
|
virtual QList<QAction*> contextMenuFeedsList();
|
||||||
virtual void updateCounts(bool including_total_count);
|
|
||||||
|
|
||||||
Search* probeById(const QString& custom_id);
|
Search* probeById(const QString& custom_id);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user