[Fwd: patch for the bug 114384 [bnc] [calendar]]



Hi,
   This patch has been approved by the maintainer. It prevents
evolution-data-server consuming 100% cpu while loading calendar. 

thanks, Chenthill.
--- Begin Message ---
Hi,
   The attached patch removes creation of e_cal_components for the
recurring instances which causes the cpu usage to raise. 

thanks, Chenthill.
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.510
diff -u -p -r1.510 ChangeLog
--- calendar/ChangeLog	25 Aug 2005 12:20:43 -0000	1.510
+++ calendar/ChangeLog	1 Sep 2005 09:42:52 -0000
@@ -1,3 +1,11 @@
+2005-09-01  Chenthill Palanisamy  <pchenthill novell com>
+
+	Fixes #114384
+	* backends/groupwise/e-cal-backend-groupwise.c: (compare_prefix),
+	(get_deltas): Do not get form the calendar events for recurring
+	appointments, just compare the prefix of the cache key to identify
+	the presence of the item.
+
 2005-08-25  Chenthill Palanisamy  <pchenthill novell com>
 
 	Fixes #312853
Index: calendar/backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.164
diff -u -p -r1.164 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	31 Aug 2005 04:21:52 -0000	1.164
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	1 Sep 2005 09:42:52 -0000
@@ -212,6 +212,11 @@ populate_cache (ECalBackendGroupwise *cb
 
 	return E_GW_CONNECTION_STATUS_OK;
 }
+static gboolean
+compare_prefix (gconstpointer a, gconstpointer b)
+{
+	return !(g_str_has_prefix ((const char *)a, (const char *)b));
+}
 
 static gboolean
 get_deltas (gpointer handle)
@@ -467,49 +472,24 @@ get_deltas (gpointer handle)
 
 	for (l = total_list; l != NULL; l = l->next) {
 		EGwItemCalId *calid = (EGwItemCalId *)	l->data;
+		GCompareFunc func = NULL;
+		GSList *remove = NULL;
 
-
-		if (calid->ical_id) {
-			if (!g_slist_find_custom (cache_keys, calid->ical_id, (GCompareFunc) strcmp)) {
-				g_ptr_array_add (uid_array, g_strdup (calid->item_id));
-				needs_to_get = TRUE;
-			} else  {
-				continue;
-			}
-		}
-
-		if (calid->recur_key) {
-			GSList *comp_list = e_cal_backend_cache_get_components_by_uid (priv->cache, calid->recur_key);			
-			if (!comp_list) {
-				g_ptr_array_add (uid_array, g_strdup (calid->item_id));
-				needs_to_get = TRUE;
-			} else {
-				/* There may be one instance added to an existing recurring appointment */
-				GSList *l;
-				gboolean found = FALSE;
-
-				for (l = comp_list; l !=NULL; l = l->next) {
-					ECalComponent *comp = E_CAL_COMPONENT (l->data);	
-
-					if (g_str_equal (calid->item_id, e_cal_component_get_gw_id (comp))) {
-						found = TRUE;
-						break;
-					}
-				}
-
-				if (comp_list) {
-					g_slist_foreach (comp_list, (GFunc)g_object_unref, NULL);
-					comp_list = NULL;
-				}
-
-				if (!found) {
-					needs_to_get = TRUE;
-					g_ptr_array_add (uid_array, g_strdup (calid->item_id));
-				}
-			}
+		if (calid->ical_id) 
+			func = (GCompareFunc) strcmp;
+		else
+			func = (GCompareFunc) compare_prefix;
+
+		if (!(remove = g_slist_find_custom (cache_keys, calid->ical_id ? calid->ical_id :
+						calid->recur_key,  func))) {
+			g_ptr_array_add (uid_array, g_strdup (calid->item_id));
+			needs_to_get = TRUE;
+		} else  {
+			cache_keys = g_slist_delete_link (cache_keys, remove);
+			continue;
 		}
 
-	}	
+	}
 
 	if (needs_to_get) {
 		e_gw_connection_get_items_from_ids (priv->cnc,
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.162
diff -u -p -r1.162 ChangeLog
--- servers/groupwise/ChangeLog	24 Aug 2005 11:44:32 -0000	1.162
+++ servers/groupwise/ChangeLog	1 Sep 2005 09:42:53 -0000
@@ -1,3 +1,8 @@
+2005-08-26  Chenthill Palanisamy  <pchenthill novell com>
+
+	* e-gw-connection.c: (e_gw_connection_read_cal_ids): Get 
+	the ids of tasks and appointment only.
+
 2005-08-24  Sankar P  <psankar novell com>
 	
 	* e-gw-connection.[ch] :
Index: servers/groupwise/e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.130
diff -u -p -r1.130 e-gw-connection.c
--- servers/groupwise/e-gw-connection.c	24 Aug 2005 11:44:32 -0000	1.130
+++ servers/groupwise/e-gw-connection.c	1 Sep 2005 09:42:53 -0000
@@ -3421,8 +3421,17 @@ e_gw_connection_read_cal_ids (EGwConnect
 			subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
 		SoupSoapParameter *param_id;
 		EGwItemCalId *calid = g_new0 (EGwItemCalId, 1);
-		char *id = NULL;
+		char *id = NULL, *item_type = NULL;
 		
+		item_type = soup_soap_parameter_get_property (subparam, "type");
+		
+		if (!(g_str_equal (item_type, "Appointment") || g_str_equal (item_type, "Task"))) {
+			g_free (item_type);
+			continue;	
+		}
+			 
+		g_free (item_type);
+
 		param_id = soup_soap_parameter_get_first_child_by_name (subparam, "id");
 		if (!param_id) {
 			if (*list) {

--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]