[tracker-miners/wip/carlosg/batches-and-resources: 11/31] libtracker-miner: Fix TrackerMinerFS timer initialization




commit 602f62999199c1b54a0150eb3ce57ef1263e4e8b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Dec 5 14:00:24 2020 +0100

    libtracker-miner: Fix TrackerMinerFS timer initialization
    
    There was a path mistakenly re-starting the timer based on extraction
    timer conditionals. This resets the timer every time, so we were
    forgetting some time spent on TrackerFileNotifier andskewing the result.
    
    While at it, try to be a bit more truthful, and account the time since
    the miner is started (Not accounting: SPARQL connection initialization
    time and startup timeout) after miner initialization.

 src/libtracker-miner/tracker-miner-fs.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index da045c127..95e27b491 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1038,6 +1038,11 @@ miner_started (TrackerMiner *miner)
 
        fs->priv->been_started = TRUE;
 
+       if (fs->priv->timer_stopped) {
+               g_timer_start (fs->priv->timer);
+               fs->priv->timer_stopped = FALSE;
+       }
+
        g_object_set (miner,
                      "progress", 0.0,
                      "status", "Initializing",
@@ -1609,11 +1614,6 @@ miner_handle_next_item (TrackerMinerFS *fs)
        GString *source_task_sparql = NULL;
        GFileInfo *info = NULL;
 
-       if (fs->priv->timer_stopped) {
-               g_timer_start (fs->priv->timer);
-               fs->priv->timer_stopped = FALSE;
-       }
-
        if (tracker_task_pool_limit_reached (TRACKER_TASK_POOL (fs->priv->sparql_buffer))) {
                /* Task pool is full, give it a break */
                return FALSE;
@@ -2042,11 +2042,6 @@ file_notifier_directory_started (TrackerFileNotifier *notifier,
                fs->priv->timer_stopped = FALSE;
        }
 
-       if (fs->priv->extraction_timer_stopped) {
-               g_timer_start (fs->priv->timer);
-               fs->priv->extraction_timer_stopped = FALSE;
-       }
-
        /* Always set the progress here to at least 1%, and the remaining time
          * to -1 as we cannot guess during crawling (we don't know how many directories
          * we will find) */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]