[tracker] libtracker-miner: Avoid changing order of elements in the processing queue
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Avoid changing order of elements in the processing queue
- Date: Mon, 14 Mar 2016 22:28:04 +0000 (UTC)
commit 48422db21d29e0459c5478445064273589eeb360
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Mar 14 01:14:24 2016 +0100
libtracker-miner: Avoid changing order of elements in the processing queue
If should_wait() returns TRUE for an element, we end up putting the file in
the queue again and incrementing its reentry counter. This situation should
be deemed normal, so we can just peek the element, and only pop it if we
should not wait.
src/libtracker-miner/tracker-miner-fs.c | 52 +++++++++---------------------
1 files changed, 16 insertions(+), 36 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index dc533a3..551eb0c 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -2183,8 +2183,8 @@ item_queue_get_next_file (TrackerMinerFS *fs,
}
/* Deleted items second */
- queue_file = tracker_priority_queue_pop (fs->priv->items_deleted,
- &priority);
+ queue_file = tracker_priority_queue_peek (fs->priv->items_deleted,
+ &priority);
if (queue_file) {
*source_file = NULL;
@@ -2201,23 +2201,18 @@ item_queue_get_next_file (TrackerMinerFS *fs,
*file = NULL;
trace_eq_push_head ("DELETED", queue_file, "Should wait");
-
- /* Need to postpone event... */
- if (item_reenqueue (fs, fs->priv->items_deleted, queue_file, priority - 1)) {
- return QUEUE_WAIT;
- } else {
- return QUEUE_NONE;
- }
+ return QUEUE_WAIT;
}
+ tracker_priority_queue_pop (fs->priv->items_deleted, NULL);
*file = queue_file;
*priority_out = priority;
return QUEUE_DELETED;
}
/* Created items next */
- queue_file = tracker_priority_queue_pop (fs->priv->items_created,
- &priority);
+ queue_file = tracker_priority_queue_peek (fs->priv->items_created,
+ &priority);
if (queue_file) {
*source_file = NULL;
@@ -2255,23 +2250,18 @@ item_queue_get_next_file (TrackerMinerFS *fs,
*file = NULL;
trace_eq_push_head ("CREATED", queue_file, "Should wait");
-
- /* Need to postpone event... */
- if (item_reenqueue (fs, fs->priv->items_created, queue_file, priority - 1)) {
- return QUEUE_WAIT;
- } else {
- return QUEUE_NONE;
- }
+ return QUEUE_WAIT;
}
+ tracker_priority_queue_pop (fs->priv->items_created, NULL);
*file = queue_file;
*priority_out = priority;
return QUEUE_CREATED;
}
/* Updated items next */
- queue_file = tracker_priority_queue_pop (fs->priv->items_updated,
- &priority);
+ queue_file = tracker_priority_queue_peek (fs->priv->items_updated,
+ &priority);
if (queue_file) {
*file = queue_file;
*source_file = NULL;
@@ -2296,23 +2286,18 @@ item_queue_get_next_file (TrackerMinerFS *fs,
*file = NULL;
trace_eq_push_head ("UPDATED", queue_file, "Should wait");
-
- /* Need to postpone event... */
- if (item_reenqueue (fs, fs->priv->items_updated, queue_file, priority - 1)) {
- return QUEUE_WAIT;
- } else {
- return QUEUE_NONE;
- }
+ return QUEUE_WAIT;
}
+ tracker_priority_queue_pop (fs->priv->items_updated, NULL);
*priority_out = priority;
return QUEUE_UPDATED;
}
/* Moved items next */
- data = tracker_priority_queue_pop (fs->priv->items_moved,
- &priority);
+ data = tracker_priority_queue_peek (fs->priv->items_moved,
+ &priority);
if (data) {
trace_eq_pop_head_2 ("MOVED", data->file, data->source_file);
@@ -2342,15 +2327,10 @@ item_queue_get_next_file (TrackerMinerFS *fs,
*source_file = NULL;
trace_eq_push_head_2 ("MOVED", data->source_file, data->file, "Should wait");
-
- /* Need to postpone event... */
- if (item_reenqueue_full (fs, fs->priv->items_moved, data->file, data, priority - 1)) {
- return QUEUE_WAIT;
- } else {
- return QUEUE_NONE;
- }
+ return QUEUE_WAIT;
}
+ tracker_priority_queue_pop (fs->priv->items_moved, NULL);
*file = g_object_ref (data->file);
*source_file = g_object_ref (data->source_file);
*priority_out = priority;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]