evolution-data-server r9352 - trunk/camel



Author: sragavan
Date: Thu Aug 14 19:39:29 2008
New Revision: 9352
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9352&view=rev

Log:
2008-08-15  Srinivasa Ragavan  <sragavan novell com>

	* camel/camel-folder-summary.c: Debug the counts temporarily and don't
	try commit when therez nothing. We save lot of db calls.


Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-folder-summary.c

Modified: trunk/camel/camel-folder-summary.c
==============================================================================
--- trunk/camel/camel-folder-summary.c	(original)
+++ trunk/camel/camel-folder-summary.c	Thu Aug 14 19:39:29 2008
@@ -728,6 +728,25 @@
 	return res;
 }
 
+static void
+count_changed_uids (char *key, CamelMessageInfoBase *info, int *count)
+{
+	if (info->dirty)
+		(*count)++;
+}
+
+static int 
+cfs_count_dirty (CamelFolderSummary *s)
+{
+	int count = 0;
+
+	CAMEL_SUMMARY_LOCK (s, summary_lock);
+	g_hash_table_foreach (s->loaded_infos, (GHFunc) count_changed_uids, &count);
+	CAMEL_SUMMARY_UNLOCK (s, summary_lock);
+
+	return count;
+}
+
 #warning "FIXME: I should have a better LRU algorithm "
 static gboolean
 remove_item (char *key, CamelMessageInfoBase *info, CamelFolderSummary *s)
@@ -1289,7 +1308,7 @@
 {
 	CamelDB *cdb = s->folder->cdb;
 	CamelFIRecord *record;
-	int ret;
+	int ret, count;
 
 	d(printf ("\ncamel_folder_summary_save_to_db called \n"));
 
@@ -1298,6 +1317,10 @@
 
 	s->flags &= ~CAMEL_SUMMARY_DIRTY;
 
+	count= cfs_count_dirty(s);
+	printf("Saving %d/%d dirty records of %s\n", count, g_hash_table_size (s->loaded_infos), s->folder->full_name);
+	if (!count)
+		return 0;
 
 	camel_db_begin_transaction (cdb, ex);
 



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