[tracker] libtracker-miner: Remove operations on children on deleted folders



commit 58da1a0a868c4e2cbcab22de505af02d7c399124
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 21 21:03:04 2015 +0200

    libtracker-miner: Remove operations on children on deleted folders
    
    This is an optimization to reduce the number of queries that we
    perform across the deletion of large directory trees.

 src/libtracker-miner/tracker-miner-fs.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index ef53ff4..72bba02 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2884,6 +2884,30 @@ check_item_queues (TrackerMinerFS *fs,
                        cancel_writeback_task (fs, file);
                }
 
+               if (tracker_file_notifier_get_file_type (fs->priv->file_notifier,
+                                                        file) == G_FILE_TYPE_DIRECTORY) {
+                       if (tracker_priority_queue_foreach_remove (fs->priv->items_updated,
+                                                                  (GEqualFunc) g_file_has_parent,
+                                                                  file,
+                                                                  (GDestroyNotify) g_object_unref)) {
+                               g_debug ("  Deleting previous unhandled UPDATED events on children");
+                       }
+
+                       if (tracker_priority_queue_foreach_remove (fs->priv->items_created,
+                                                                  (GEqualFunc) g_file_has_parent,
+                                                                  file,
+                                                                  (GDestroyNotify) g_object_unref)) {
+                               g_debug ("  Deleting previous unhandled CREATED events on children");
+                       }
+
+                       if (tracker_priority_queue_foreach_remove (fs->priv->items_deleted,
+                                                                  (GEqualFunc) g_file_has_parent,
+                                                                  file,
+                                                                  (GDestroyNotify) g_object_unref)) {
+                               g_debug ("  Deleting previous unhandled DELETED events on children");
+                       }
+               }
+
                /* Remove all previous updates */
                if (tracker_priority_queue_foreach_remove (fs->priv->items_updated,
                                                           (GEqualFunc) g_file_equal,


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