2007-06-25 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Mon, 25 Jun 2007 10:46:33 +0000 (10:46 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Mon, 25 Jun 2007 10:46:33 +0000 (10:46 +0000)
* 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
ChangeLog2
libmodest-dbus-client/libmodest-dbus-client.c
src/dbus_api/modest-dbus-callbacks.c
src/modest-search.c

index c1bd8fa..acb6b92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1 @@
-2007-06-25  Murray Cumming,,,  <murrayc@murrayc-desktop>
-
-       reviewed by: <delete if not using a buddy>
-
-       * src/maemo/easysetup/modest-wizard-dialog.c: (init):
-
 * please check the svn log instead
 * please check the svn log instead
index 567ff6d..7d75478 100644 (file)
@@ -1,5 +1,19 @@
 2007-06-25  Murray Cumming  <murrayc@murrayc.com>
 
 2007-06-25  Murray Cumming  <murrayc@murrayc.com>
 
+       * 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  <murrayc@murrayc.com>
+
        * 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.
        * 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.
index 85d9447..5a6113a 100644 (file)
@@ -617,7 +617,6 @@ libmodest_dbus_client_search (osso_context_t          *osso_ctx,
 
        DBusMessage *msg;
        dbus_bool_t res;
 
        DBusMessage *msg;
        dbus_bool_t res;
-       DBusError err;
        DBusConnection *con;
        DBusMessageIter iter;
        DBusMessageIter child;
        DBusConnection *con;
        DBusMessageIter iter;
        DBusMessageIter child;
@@ -674,22 +673,29 @@ libmodest_dbus_client_search (osso_context_t          *osso_ctx,
 
        dbus_error_init (&err);
 
 
        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);
        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);
 
 
        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)) {
 
 
        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);
 
 
        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);
 
        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) {
        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;
        }
 
                return FALSE;
        }
 
index da14c7a..3c4f70b 100644 (file)
@@ -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
        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);
        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) {
                
                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,
                        
                        DBusMessageIter struct_iter;
                        dbus_message_iter_open_container (&array_iter,
index 6fa0e6f..ab30a4c 100644 (file)
@@ -548,6 +548,7 @@ modest_search_account (TnyAccount *account, ModestSearch *search)
        g_object_unref (iter);
        g_object_unref (folders);
 
        g_object_unref (iter);
        g_object_unref (folders);
 
+       /* printf ("DEBUG: %s: hits length = %d\n", __FUNCTION__, g_list_length (hits)); */
        return hits;
 }
 
        return hits;
 }
 
@@ -595,6 +596,7 @@ modest_search_all_accounts (ModestSearch *search)
        g_object_unref (accounts);
        g_object_unref (iter);
 
        g_object_unref (accounts);
        g_object_unref (iter);
 
+       /* printf ("DEBUG: %s: end: hits length=%d\n", __FUNCTION__, g_list_length(hits)); */
        return hits;
 }
 
        return hits;
 }