[tracker/miner-paranoid-logs: 3/3] libtracker-miner: If parent being processed, wait
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/miner-paranoid-logs: 3/3] libtracker-miner: If parent being processed, wait
- Date: Thu, 5 Aug 2010 18:14:28 +0000 (UTC)
commit e98c712412ebd05b860ac535eaff56c7e0b09650
Author: Aleksander Morgado <aleksander lanedo com>
Date: Thu Aug 5 20:10:39 2010 +0200
libtracker-miner: If parent being processed, wait
src/libtracker-miner/tracker-miner-fs.c | 47 +++++++++++++++++++++++++++---
1 files changed, 42 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 97f68d9..a870b82 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2176,6 +2176,35 @@ fill_in_queue (TrackerMinerFS *fs,
}
}
+
+static gboolean
+should_wait (TrackerMinerFS *fs,
+ GFile *file)
+{
+ GFile *parent;
+
+ /* Is the item already being processed? */
+ if (process_data_find (fs, file, TRUE)) {
+ /* Yes, a previous event on same item currently
+ * being processed */
+ return TRUE;
+ }
+
+ /* Is the item's parent being processed right now? */
+ parent = g_file_get_parent (file);
+ if (parent) {
+ if (process_data_find (fs, parent, TRUE)) {
+ /* Yes, a previous event on the parent of this item
+ * currently being processed */
+ g_object_unref (parent);
+ return TRUE;
+ }
+
+ g_object_unref (parent);
+ }
+ return FALSE;
+}
+
static QueueState
item_queue_get_next_file (TrackerMinerFS *fs,
GFile **file,
@@ -2194,7 +2223,9 @@ item_queue_get_next_file (TrackerMinerFS *fs,
return QUEUE_IGNORE_NEXT_UPDATE;
}
- if (process_data_find (fs, queue_file, TRUE)) {
+ /* If the same item OR its first parent is currently being processed,
+ * we need to wait for this event */
+ if (should_wait (fs, queue_file)) {
*file = NULL;
/* Need to postpone event... */
g_queue_push_head (fs->private->items_deleted,
@@ -2240,7 +2271,9 @@ item_queue_get_next_file (TrackerMinerFS *fs,
return QUEUE_IGNORE_NEXT_UPDATE;
}
- if (process_data_find (fs, queue_file, TRUE)) {
+ /* If the same item OR its first parent is currently being processed,
+ * we need to wait for this event */
+ if (should_wait (fs, queue_file)) {
*file = NULL;
/* Need to postpone event... */
g_queue_push_head (fs->private->items_created,
@@ -2262,7 +2295,9 @@ item_queue_get_next_file (TrackerMinerFS *fs,
if (check_ignore_next_update (fs, queue_file))
return QUEUE_IGNORE_NEXT_UPDATE;
- if (process_data_find (fs, queue_file, TRUE)) {
+ /* If the same item OR its first parent is currently being processed,
+ * we need to wait for this event */
+ if (should_wait (fs, queue_file)) {
*file = NULL;
/* Need to postpone event... */
g_queue_push_head (fs->private->items_updated,
@@ -2283,8 +2318,10 @@ item_queue_get_next_file (TrackerMinerFS *fs,
return QUEUE_IGNORE_NEXT_UPDATE;
}
- if (process_data_find (fs, data->file, TRUE) ||
- process_data_find (fs, data->source_file, TRUE)) {
+ /* If the same item OR its first parent is currently being processed,
+ * we need to wait for this event */
+ if (should_wait (fs, data->file) ||
+ should_wait (fs, data->source_file)) {
*file = NULL;
*source_file = NULL;
/* Need to postpone event... */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]