From d5e48a97879ada8cf2932a5f125deb2c70ebefb2 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Mon, 25 Jun 2007 10:46:33 +0000 Subject: [PATCH] 2007-06-25 Murray Cumming * libmodest-dbus-client/libmodest-dbus-client.c: (libmodest_dbus_client_search), (libmodest_dbus_client_get_folders): Use large timeouts (2 minutes) instead of 1 second, because the search gets folders and messages from the server, which can take a long time. When it times out, osso-global-search will report no results. We need to specify whether we should search only cached information (maybe with a user preference), and the osso-email-search-plugin API should really be improved to allow that option, and to allow results to be delivered asynchronously in batches.| pmo-trunk-r2395 --- ChangeLog | 6 ----- ChangeLog2 | 14 ++++++++++ libmodest-dbus-client/libmodest-dbus-client.c | 34 +++++++++++++++---------- src/dbus_api/modest-dbus-callbacks.c | 6 ++++- src/modest-search.c | 2 ++ 5 files changed, 42 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1bd8fa..acb6b92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1 @@ -2007-06-25 Murray Cumming,,, - - reviewed by: - - * src/maemo/easysetup/modest-wizard-dialog.c: (init): - * please check the svn log instead diff --git a/ChangeLog2 b/ChangeLog2 index 567ff6d..7d75478 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,5 +1,19 @@ 2007-06-25 Murray Cumming + * libmodest-dbus-client/libmodest-dbus-client.c: + (libmodest_dbus_client_search), + (libmodest_dbus_client_get_folders): Use large timeouts (2 minutes) + instead of 1 second, because the search gets folders and messages from + the server, which can take a long time. When it times out, + osso-global-search will report no results. + + We need to specify whether we should search only cached information + (maybe with a user preference), and the osso-email-search-plugin + API should really be improved to allow that option, and to allow results + to be delivered asynchronously in batches. + +2007-06-25 Murray Cumming + * src/maemo/easysetup/modest-wizard-dialog.c: (init): Fix a typo to fix the osso 1.1. build. See the TODO comment though - GTK_ICON_SIZE_DIALOG is probably the wrong size. diff --git a/libmodest-dbus-client/libmodest-dbus-client.c b/libmodest-dbus-client/libmodest-dbus-client.c index 85d9447..5a6113a 100644 --- a/libmodest-dbus-client/libmodest-dbus-client.c +++ b/libmodest-dbus-client/libmodest-dbus-client.c @@ -617,7 +617,6 @@ libmodest_dbus_client_search (osso_context_t *osso_ctx, DBusMessage *msg; dbus_bool_t res; - DBusError err; DBusConnection *con; DBusMessageIter iter; DBusMessageIter child; @@ -674,22 +673,29 @@ libmodest_dbus_client_search (osso_context_t *osso_ctx, dbus_error_init (&err); - timeout = 1000; //XXX - osso_rpc_get_timeout (osso_ctx, &timeout); + /* Use a long timeout (2 minutes) because the search currently + * gets folders and messages from the servers. */ + timeout = 120000; //milliseconds. + //osso_rpc_get_timeout (osso_ctx, &timeout); + /*printf("DEBUG: %s: Before dbus_connection_send_with_reply_and_block().\n", + __FUNCTION__); */ + /* TODO: Detect the timeout somehow. */ + DBusError err; reply = dbus_connection_send_with_reply_and_block (con, msg, timeout, &err); + /* printf("DEBUG: %s: dbus_connection_send_with_reply_and_block() finished.\n", + __FUNCTION__); */ dbus_message_unref (msg); - - if (reply == NULL) { - //ULOG_ERR_F("dbus_connection_send_with_reply_and_block error: %s", err.message); - //XXX to GError?! - return FALSE; - } + if (!reply) { + g_warning("%s: dbus_connection_send_with_reply_and_block() error: %s", + __FUNCTION__, err.message); + return FALSE; + } switch (dbus_message_get_type (reply)) { @@ -895,8 +901,10 @@ libmodest_dbus_client_get_folders (osso_context_t *osso_ctx, dbus_message_set_auto_start (msg, TRUE); - gint timeout = 1000; //XXX - osso_rpc_get_timeout (osso_ctx, &timeout); + /* Use a long timeout (2 minutes) because the search currently + * gets folders from the servers. */ + gint timeout = 120000; + //osso_rpc_get_timeout (osso_ctx, &timeout); DBusError err; dbus_error_init (&err); @@ -909,8 +917,8 @@ libmodest_dbus_client_get_folders (osso_context_t *osso_ctx, msg = NULL; if (reply == NULL) { - //ULOG_ERR_F("dbus_connection_send_with_reply_and_block error: %s", err.message); - //XXX to GError?! + g_warning("%s: dbus_connection_send_with_reply_and_block() error:\n %s", + __FUNCTION__, err.message); return FALSE; } diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index da14c7a..3c4f70b 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -1053,6 +1053,10 @@ on_dbus_method_search (DBusConnection *con, DBusMessage *message) search.flags |= MODEST_SEARCH_USE_OGS; g_debug ("%s: Starting search for %s", __FUNCTION__, search.query); #endif + + /* Note that this currently gets folders and messages from the servers, + * which can take a long time. libmodest_dbus_client_search() can timeout, + * reporting no results, if this takes a long time: */ hits = modest_search_all_accounts (&search); reply = dbus_message_new_method_return (message); @@ -1101,7 +1105,7 @@ get_folders_result_to_message (DBusMessage *reply, const gchar *folder_name = (const gchar*)list_iter->data; if (folder_name) { - g_debug ("DEBUG: %s: Adding folder: %s", __FUNCTION__, folder_name); + /* g_debug ("DEBUG: %s: Adding folder: %s", __FUNCTION__, folder_name); */ DBusMessageIter struct_iter; dbus_message_iter_open_container (&array_iter, diff --git a/src/modest-search.c b/src/modest-search.c index 6fa0e6f..ab30a4c 100644 --- a/src/modest-search.c +++ b/src/modest-search.c @@ -548,6 +548,7 @@ modest_search_account (TnyAccount *account, ModestSearch *search) g_object_unref (iter); g_object_unref (folders); + /* printf ("DEBUG: %s: hits length = %d\n", __FUNCTION__, g_list_length (hits)); */ return hits; } @@ -595,6 +596,7 @@ modest_search_all_accounts (ModestSearch *search) g_object_unref (accounts); g_object_unref (iter); + /* printf ("DEBUG: %s: end: hits length=%d\n", __FUNCTION__, g_list_length(hits)); */ return hits; } -- 1.7.9.5