Commit 4320a7ad authored by Carlos Garnacho's avatar Carlos Garnacho Committed by Martyn Russell

libtracker-miner: Hook up directly to pools' state

This way the miner is able to resume/pause as the different
task pools notify on ::limit-reached, instead of relying
on the pertinent item_queue_handlers_set_up() call at the
right time.
parent 8e064123
......@@ -396,6 +396,9 @@ static gboolean miner_fs_has_children_without_parent (TrackerMinerFS *fs,
static void task_pool_cancel_foreach (gpointer data,
gpointer user_data);
static void task_pool_limit_reached_notify_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data);
static gboolean miner_fs_is_forced_mtime_checking_directory (TrackerMinerFS *fs,
GFile *directory);
......@@ -753,7 +756,12 @@ tracker_miner_fs_init (TrackerMinerFS *object)
/* Create processing pools */
priv->task_pool = tracker_task_pool_new (DEFAULT_WAIT_POOL_LIMIT);
g_signal_connect (priv->task_pool, "notify::limit-reached",
G_CALLBACK (task_pool_limit_reached_notify_cb), object);
priv->writeback_pool = tracker_task_pool_new (DEFAULT_WAIT_POOL_LIMIT);
g_signal_connect (priv->writeback_pool, "notify::limit-reached",
G_CALLBACK (task_pool_limit_reached_notify_cb), object);
/* Set up the crawlers now we have config and hal */
priv->crawler = tracker_crawler_new ();
......@@ -829,6 +837,10 @@ miner_fs_initable_init (GInitable *initable,
g_object_get (initable, "processing-pool-ready-limit", &limit, NULL);
priv->sparql_buffer = tracker_sparql_buffer_new (tracker_miner_get_connection (TRACKER_MINER (initable)),
limit);
g_signal_connect (priv->sparql_buffer, "notify::limit-reached",
G_CALLBACK (task_pool_limit_reached_notify_cb),
initable);
return TRUE;
}
......@@ -1019,6 +1031,16 @@ fs_get_property (GObject *object,
}
}
static void
task_pool_limit_reached_notify_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
if (!tracker_task_pool_limit_reached (TRACKER_TASK_POOL (object))) {
item_queue_handlers_set_up (TRACKER_MINER_FS (user_data));
}
}
static gboolean
fs_defaults (TrackerMinerFS *fs,
GFile *file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment