[tracker] libtracker-miner: Do not insert RootData for the same file multiple times
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Do not insert RootData for the same file multiple times
- Date: Thu, 5 May 2016 11:46:08 +0000 (UTC)
commit bf8d1f7cd3d1c6355024e885fcf6c962c6046f3a
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue May 3 00:22:46 2016 +0200
libtracker-miner: Do not insert RootData for the same file multiple times
If the file is already there, there is no need to crawl/recheck it
several times.
src/libtracker-miner/tracker-file-notifier.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index e9f2ef9..69d32b6 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -1035,6 +1035,15 @@ crawler_finished_cb (TrackerCrawler *crawler,
}
}
+static gint
+find_directory_root (RootData *data,
+ GFile *file)
+{
+ if (data->root == file)
+ return 0;
+ return -1;
+}
+
static void
notifier_queue_file (TrackerFileNotifier *notifier,
GFile *file,
@@ -1043,6 +1052,14 @@ notifier_queue_file (TrackerFileNotifier *notifier,
TrackerFileNotifierPrivate *priv = notifier->priv;
RootData *data = root_data_new (notifier, file, flags);
+ if (priv->current_index_root &&
+ priv->current_index_root->root == file)
+ return;
+
+ if (g_list_find_custom (priv->pending_index_roots, file,
+ (GCompareFunc) find_directory_root))
+ return;
+
if (flags & TRACKER_DIRECTORY_FLAG_PRIORITY) {
priv->pending_index_roots = g_list_prepend (priv->pending_index_roots, data);
} else {
@@ -1417,15 +1434,6 @@ indexing_tree_directory_added (TrackerIndexingTree *indexing_tree,
crawl_directories_start (notifier);
}
-static gint
-find_directory_root (RootData *data,
- GFile *file)
-{
- if (data->root == file)
- return 0;
- return -1;
-}
-
static void
indexing_tree_directory_removed (TrackerIndexingTree *indexing_tree,
GFile *directory,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]