tracker r1865 - in branches/indexer-split: . src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1865 - in branches/indexer-split: . src/trackerd
- Date: Fri, 4 Jul 2008 14:51:02 +0000 (UTC)
Author: mr
Date: Fri Jul 4 14:51:02 2008
New Revision: 1865
URL: http://svn.gnome.org/viewvc/tracker?rev=1865&view=rev
Log:
* src/trackerd/tracker-crawler.c: Don't check if the indexer is
running first, just send files. Also, don't send the next batch
until the last patch was sent successfully. Make sure we add files
back onto the queue if they couldn't be sent.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/trackerd/tracker-crawler.c
Modified: branches/indexer-split/src/trackerd/tracker-crawler.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.c (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.c Fri Jul 4 14:51:02 2008
@@ -55,6 +55,9 @@
GSList *directory_queues_order;
GSList *file_queues_order;
+ GStrv files_sent;
+ gchar *files_sent_module_name;
+
guint idle_id;
guint files_queue_handle_id;
@@ -239,6 +242,10 @@
GQueue *q;
gchar *module_name;
+ if (module_name_p) {
+ *module_name_p = NULL;
+ }
+
for (l = crawler->private->directory_queues_order; l; l = l->next) {
module_name = l->data;
q = g_hash_table_lookup (crawler->private->directory_queues, module_name);
@@ -525,89 +532,86 @@
GError *error,
gpointer user_data)
{
- GStrv files;
+ TrackerCrawler *crawler;
+
+ crawler = TRACKER_CRAWLER (user_data);
if (error) {
+ GQueue *queue;
+ gchar **p;
+
g_message ("Files could not be checked by the indexer, %s",
error->message);
g_error_free (error);
+
+ /* Put files back into queue */
+ queue = g_hash_table_lookup (crawler->private->file_queues,
+ crawler->private->files_sent_module_name);
+
+ if (queue) {
+ gint i;
+
+ for (p = crawler->private->files_sent, i = 0; *p; p++, i++) {
+ g_queue_push_nth (queue, g_file_new_for_path (*p), i);
+ }
+ }
} else {
g_debug ("Sent!");
}
- files = (GStrv) user_data;
- g_strfreev (files);
+ g_strfreev (crawler->private->files_sent);
+ crawler->private->files_sent = NULL;
+
+ g_free (crawler->private->files_sent_module_name);
+ crawler->private->files_sent_module_name = NULL;
+
+ g_object_unref (crawler);
}
-static void
-indexer_get_running_cb (DBusGProxy *proxy,
- gboolean running,
- GError *error,
- gpointer user_data)
+static gboolean
+file_queue_handler_cb (gpointer user_data)
{
TrackerCrawler *crawler;
- GQueue *queue = NULL;
+ GQueue *queue;
GStrv files;
gchar *module_name;
guint total;
crawler = TRACKER_CRAWLER (user_data);
-
- if (error || !running) {
- g_message ("%s",
- error ? error->message : "Indexer exists but is not available yet, waiting...");
-
- g_object_unref (crawler);
- g_clear_error (&error);
-
- return;
+
+ /* This is here so we don't try to send something if we are
+ * still waiting for a response from the last send.
+ */
+ if (crawler->private->files_sent) {
+ g_message ("Still waiting for response from indexer, "
+ "not sending more files yet");
+ return TRUE;
}
queue = queue_get_next_for_files_with_data (crawler, &module_name);
if (!queue || !module_name) {
g_message ("No file queues to process");
- g_object_unref (crawler);
-
- return;
+ crawler->private->files_queue_handle_id = 0;
+ return FALSE;
}
total = g_queue_get_length (queue);
files = tracker_dbus_queue_gfile_to_strv (queue, FILES_QUEUE_PROCESS_MAX);
-
- g_message ("File check queue processed, sending first %d/%d, for module:'%s' to the indexer",
+
+ /* Save the GStrv somewhere so we know we are sending still */
+ crawler->private->files_sent = files;
+ crawler->private->files_sent_module_name = g_strdup (module_name);
+
+ g_message ("Sending first %d/%d files, for module:'%s' to the indexer",
g_strv_length (files),
total,
module_name);
- org_freedesktop_Tracker_Indexer_files_check_async (proxy,
- module_name,
- (const gchar **) files,
+ org_freedesktop_Tracker_Indexer_files_check_async (tracker_dbus_indexer_get_proxy (),
+ crawler->private->files_sent_module_name,
+ (const gchar**) crawler->private->files_sent,
indexer_check_files_cb,
- files);
-
- g_object_unref (crawler);
-}
-
-static gboolean
-file_queue_handler_cb (gpointer user_data)
-{
- TrackerCrawler *crawler;
- GQueue *queue;
-
- crawler = TRACKER_CRAWLER (user_data);
-
- queue = queue_get_next_for_files_with_data (crawler, NULL);
-
- if (!queue) {
- g_message ("No file queues to process");
- crawler->private->files_queue_handle_id = 0;
- return FALSE;
- }
-
- /* Check we can actually talk to the indexer */
- org_freedesktop_Tracker_Indexer_get_running_async (tracker_dbus_indexer_get_proxy (),
- indexer_get_running_cb,
g_object_ref (crawler));
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]