From 8f40c0b6dce67cefa1edce0b865c9a3885d39717 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 15 Aug 2026 09:42:27 +0200 Subject: fix(status): count threads as they arrive instead of "Searching..." Item 74. runQuery() set the status bar once and only queryFinished cleared it, so the bar kept claiming a query was running for the whole walk while rows were visibly arriving behind it. Measured cold against a 1.1 GB index: the first batch reaches the model at 642 ms and the walk finishes at 5714 ms, so five seconds of a slow query read as a frozen one. onThreadsReady now sets the bar from the model's own row count after each batch, which is the number of rows the user can actually see. No timing changes; this only stops the bar from lying. The refresh branch returns before the new line, so a background refresh stays silent exactly as onQueryFinished already keeps it. That silence has its own test, which fails when the write is moved above the guard. beginRefreshForTesting() is a new seam: refreshCurrentQuery() returns early without a worker and a bare window has none, so a test cannot otherwise reach the refresh path. --- src/mainwindow.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fb34fe2..c6df95c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2086,6 +2086,18 @@ void MainWindow::onThreadsReady(const QVector &threads, } m_model->appendBatch(threads); + + // Item 74. "Searching..." was set once in runQuery() and cleared only on + // queryFinished, so it went on claiming the query was running for the whole + // walk while rows were visibly arriving behind it. Measured cold against a + // 1.1 GB index: first rows at 642 ms, done at 5714 ms, five seconds of a + // slow query reading as a frozen one. + // + // The count comes from the model rather than from a running total, since + // that is the number of rows the user can actually see. Nothing about the + // timing changes; this only stops the bar from lying. + m_statusLabel->setText(tr("Searching... %n thread(s)", "", + m_model->rowCount(QModelIndex()))); } void MainWindow::onQueryFinished(int total, quint64 generation) -- cgit v1.2.3