Commit bf8d1f7c authored by Carlos Garnacho's avatar Carlos Garnacho

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.
parent 612383bf
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment