[tracker/tracker-0.10] libtracker-miner: Make tracker_miner_fs_directory_remove() more robust
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] libtracker-miner: Make tracker_miner_fs_directory_remove() more robust
- Date: Wed, 25 May 2011 09:15:58 +0000 (UTC)
commit 532dc681d59ece6ad245035cc04f2878d1c4039f
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 23 17:26:39 2011 +0200
libtracker-miner: Make tracker_miner_fs_directory_remove() more robust
the tasks that are likely to perform I/O (extraction, crawling) are
removed first, so other non-crucial, but time consuming tasks (i.e.
monitors removal) don't get in the way.
Also, stuff from priv->crawled_directories is removed, as the miner
could pick these up for further processing.
src/libtracker-miner/tracker-miner-fs.c | 34 +++++++++++++++++++++++++++---
1 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index d49583f..76a773b 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -4214,12 +4214,22 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
{
TrackerMinerFSPrivate *priv;
gboolean return_val = FALSE;
+ GTimer *timer;
GList *dirs;
g_return_val_if_fail (TRACKER_IS_MINER_FS (fs), FALSE);
g_return_val_if_fail (G_IS_FILE (file), FALSE);
priv = fs->private;
+ timer = g_timer_new ();
+ g_debug ("Removing directory");
+
+ /* Cancel all pending tasks on files inside the path given by file */
+ tracker_processing_pool_foreach (priv->processing_pool,
+ processing_pool_cancel_foreach,
+ file);
+
+ g_debug (" Cancelled processing pool tasks at %f\n", g_timer_elapsed (timer, NULL));
if (fs->private->current_directory) {
GFile *current_file;
@@ -4265,20 +4275,36 @@ tracker_miner_fs_directory_remove (TrackerMinerFS *fs,
}
}
+ dirs = fs->private->crawled_directories->head;
+
+ while (dirs) {
+ CrawledDirectoryData *data = dirs->data;
+ GList *link = dirs;
+
+ dirs = dirs->next;
+
+ if (g_file_equal (file, data->tree->data) ||
+ g_file_has_prefix (file, data->tree->data)) {
+ crawled_directory_data_free (data);
+ g_queue_delete_link (priv->crawled_directories, link);
+ return_val = TRUE;
+ }
+ }
+
/* Remove anything contained in the removed directory
* from all relevant processing queues.
*/
check_files_removal (priv->items_updated, file);
check_files_removal (priv->items_created, file);
- /* Cancel all pending tasks on files inside the path given by file */
- tracker_processing_pool_foreach (fs->private->processing_pool,
- processing_pool_cancel_foreach,
- file);
+ g_debug (" Removed files at %f\n", g_timer_elapsed (timer, NULL));
/* Remove all monitors */
tracker_monitor_remove_recursively (fs->private->monitor, file);
+ g_message ("Finished remove directory operation in %f\n", g_timer_elapsed (timer, NULL));
+ g_timer_destroy (timer);
+
return return_val;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]