summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-06-14 17:52:15 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-06-22 18:21:07 +0100
commitf1a75073db939ca88ddaba2e7b16280ea68bbf21 (patch)
treed5d8c731128838c48a33615b721f24ba4f9d0de0
parent9d5fc8a1d810980712e209ab032a92dbe282f1e8 (diff)
downloadtracker-f1a75073db939ca88ddaba2e7b16280ea68bbf21.tar.gz
libtracker-miner: Avoid processing item queue while it is blocked
item_add_or_update_cb() had a call to item_queue_handlers_set_up(). This was unneccessary as the queue will already be running, except in one the following cases: - the extraction or SPARQL task pools are full - the queue is blocked waiting for a specific file to process - the queue is empty Previously, while waiting for a file to process we might pop and reenqueue the next file in the queue several times, which is a waste of effort and makes it difficult to detect if the miner is stuck in an infinite loop.
-rw-r--r--src/libtracker-miner/tracker-miner-fs.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 45e1d0624..8cbf160d7 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -165,6 +165,7 @@ struct _TrackerMinerFSPrivate {
GTimer *extraction_timer;
guint item_queues_handler_id;
+ gboolean item_queue_blocked;
gdouble throttle;
@@ -1194,9 +1195,15 @@ item_add_or_update_cb (TrackerMinerFS *fs,
ctxt->priority,
sparql_buffer_task_finished_cb,
fs);
+
+ if (fs->priv->item_queue_blocked == TRUE) {
+ tracker_sparql_buffer_flush (fs->priv->sparql_buffer, "Queue handlers WAIT");
+ }
}
- if (!tracker_task_pool_limit_reached (TRACKER_TASK_POOL (fs->priv->sparql_buffer))) {
+ if (tracker_miner_fs_has_items_to_process (fs) == FALSE &&
+ tracker_task_pool_get_size (TRACKER_TASK_POOL (fs->priv->task_pool)) == 0) {
+ /* We need to run this one more time to trigger process_stop() */
item_queue_handlers_set_up (fs);
}
@@ -2028,9 +2035,12 @@ item_queue_handlers_cb (gpointer user_data)
* on with the queues... */
tracker_sparql_buffer_flush (fs->priv->sparql_buffer,
"Queue handlers WAIT");
+ fs->priv->item_queue_blocked = TRUE;
return FALSE;
}
+ fs->priv->item_queue_blocked = FALSE;
+
if (file && queue != QUEUE_DELETED &&
tracker_file_is_locked (file)) {
gchar *uri;