[tracker/miner-fs-refactor: 57/127] libtracker-miner: Avoid double checking root directories in TrackerFileNotifier



commit 446a75af014bc8390eecba16ab0c933621d81ce7
Author: Carlos Garnacho <carlos lanedo com>
Date:   Mon Oct 3 13:42:42 2011 +0200

    libtracker-miner: Avoid double checking root directories in TrackerFileNotifier
    
    If a directory happens to be both a root directory and the child of a root
    directory, it could be told to be inspected twice, only do this if this
    directory root itself is being inspected.

 src/libtracker-miner/tracker-file-notifier.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 52329b1..0753f3b 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -138,9 +138,20 @@ crawler_check_directory_cb (TrackerCrawler *crawler,
                             gpointer        user_data)
 {
 	TrackerFileNotifierPrivate *priv;
+	GFile *root;
 
 	priv = TRACKER_FILE_NOTIFIER (user_data)->priv;
 
+	/* If it's a config root itself, other than the one
+	 * currently processed, bypass it, it will be processed
+	 * when the time arrives.
+	 */
+	root = tracker_indexing_tree_get_root (priv->indexing_tree, directory, NULL);
+
+	if (root != priv->pending_index_roots->data) {
+		return FALSE;
+	}
+
 	return tracker_indexing_tree_file_is_indexable (priv->indexing_tree,
 							directory,
 							G_FILE_TYPE_DIRECTORY);
@@ -204,8 +215,11 @@ file_notifier_traverse_tree_foreach (GFile    *file,
 		/* Mtime changed, update */
 		g_signal_emit (notifier, signals[FILE_UPDATED], 0, file, FALSE);
 	} else if (!store_mtime && !disk_mtime) {
-		/* what are we doing with such file? shouldn't happen */
-		g_assert_not_reached ();
+		/* what are we doing with such file? should happen rarely,
+		 * only with files that we've queried, but we decided not
+		 * to crawl (i.e. embedded root directories, that would
+		 * be processed when that root is being crawled).
+		 */
 	}
 
 	return FALSE;



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