summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2010-05-20 16:01:53 +0200
committerMartyn Russell <martyn@lanedo.com>2010-05-20 16:20:24 +0100
commita339f5cd69694f1d508c6ed396139822b77b9072 (patch)
treee5a5835b33b1a3d5402dc08c897ee24780174b3b
parent0a0289555939b12809b262d86cc6c3ab043f6b0d (diff)
downloadtracker-a339f5cd69694f1d508c6ed396139822b77b9072.tar.gz
TrackerMinerFS: Apply to the iri cache the same fix than d3cf67b05a4.
This cache has the same flaw, incurring in the same failure if a crawl directory has legitimately changed (for example, a new file has been added).
-rw-r--r--src/libtracker-miner/tracker-miner-fs.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 3986a1b03..195cca113 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1125,15 +1125,40 @@ cache_query_cb (GObject *object,
}
}
+static gboolean
+file_is_crawl_directory (TrackerMinerFS *fs,
+ GFile *file)
+{
+ GList *dirs;
+
+ /* Check whether file is a crawl directory itself */
+ dirs = fs->private->config_directories;
+
+ while (dirs) {
+ DirectoryData *data;
+
+ data = dirs->data;
+ dirs = dirs->next;
+
+ if (g_file_equal (data->file, file)) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
static void
ensure_iri_cache (TrackerMinerFS *fs,
- GFile *parent)
+ GFile *file)
{
gchar *query, *uri;
CacheQueryData data;
+ GFile *parent;
g_hash_table_remove_all (fs->private->iri_cache);
+ parent = g_file_get_parent (file);
uri = g_file_get_uri (parent);
g_debug ("Generating IRI cache for folder: %s", uri);
@@ -1159,6 +1184,18 @@ ensure_iri_cache (TrackerMinerFS *fs,
g_main_loop_unref (data.main_loop);
g_hash_table_unref (data.values);
+
+ if (g_hash_table_size (data.values) == 0 &&
+ file_is_crawl_directory (fs, file)) {
+ gchar *query_iri;
+
+ if (item_query_exists (fs, file, &query_iri, NULL)) {
+ g_hash_table_insert (data.values,
+ g_object_ref (file), query_iri);
+ }
+ }
+
+ g_object_unref (parent);
g_free (query);
}
@@ -1346,7 +1383,7 @@ item_add_or_update (TrackerMinerFS *fs,
fs->private->current_parent_urn = NULL;
}
- ensure_iri_cache (fs, parent);
+ ensure_iri_cache (fs, file);
}
parent_urn = fs->private->current_parent_urn;
@@ -2155,29 +2192,6 @@ item_queue_handlers_set_up (TrackerMinerFS *fs)
fs);
}
-static gboolean
-file_is_crawl_directory (TrackerMinerFS *fs,
- GFile *file)
-{
- GList *dirs;
-
- /* Check whether file is a crawl directory itself */
- dirs = fs->private->config_directories;
-
- while (dirs) {
- DirectoryData *data;
-
- data = dirs->data;
- dirs = dirs->next;
-
- if (g_file_equal (data->file, file)) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
static void
ensure_mtime_cache (TrackerMinerFS *fs,
GFile *file)
@@ -2255,7 +2269,7 @@ ensure_mtime_cache (TrackerMinerFS *fs,
g_free (query);
g_main_loop_run (data.main_loop);
- }
+ }
g_main_loop_unref (data.main_loop);
g_hash_table_unref (data.values);