Commit 81d0dfbd authored by Carlos Garnacho's avatar Carlos Garnacho

libtracker-miner: Rework pre-caching of information element URNs

The use of information element URNs is pretty much reserved now to
folders. We can avoid trying to cache it for every file, we also
need to do it preemptively on less situations.
parent fb1a99cf
......@@ -1085,6 +1085,12 @@ monitor_item_updated_cb (TrackerMonitor *monitor,
/* Fetch the interned copy */
canonical = tracker_file_system_get_file (priv->file_system,
file, file_type, NULL);
if (is_directory) {
/* Ensure the folder iri is cached */
tracker_file_notifier_get_file_iri (notifier, canonical, TRUE);
}
g_signal_emit (notifier, signals[FILE_UPDATED], 0, canonical, FALSE);
if (!is_directory) {
......
......@@ -1249,6 +1249,18 @@ update_processing_task_context_free (UpdateProcessingTaskContext *ctxt)
g_slice_free (UpdateProcessingTaskContext, ctxt);
}
static void
cache_parent_folder_urn (TrackerMinerFS *fs,
GFile *file)
{
GFile *parent;
parent = g_file_get_parent (file);
tracker_file_notifier_get_file_iri (fs->priv->file_notifier,
parent, TRUE);
g_object_unref (parent);
}
static void
on_signal_gtask_complete (GObject *source,
GAsyncResult *res,
......@@ -1511,6 +1523,10 @@ item_move (TrackerMinerFS *fs,
(source_flags & TRACKER_DIRECTORY_FLAG_RECURSE) != 0)
item_remove (fs, source_file, TRUE, source_task_sparql);
/* Cache URN for source/dest folders */
cache_parent_folder_urn (fs, source_file);
cache_parent_folder_urn (fs, dest_file);
g_signal_emit (fs, signals[MOVE_FILE], 0, dest_file, source_file, recursive, &sparql);
if (sparql && sparql[0] != '\0') {
......@@ -2059,10 +2075,6 @@ miner_fs_queue_event (TrackerMinerFS *fs,
(GDestroyNotify) queue_event_free);
}
/* Ensure IRI is cached */
tracker_file_notifier_get_file_iri (fs->priv->file_notifier,
event->file, TRUE);
trace_eq_event (event);
link = tracker_priority_queue_add (fs->priv->items, event, priority);
......@@ -2390,9 +2402,6 @@ tracker_miner_fs_check_file (TrackerMinerFS *fs,
return;
}
tracker_file_notifier_get_file_iri (fs->priv->file_notifier,
file, TRUE);
event = queue_event_new (TRACKER_MINER_FS_EVENT_UPDATED, file);
trace_eq_event (event);
miner_fs_queue_event (fs, event, priority);
......
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