tracker r2187 - in branches/indexer-split: . src/libtracker-db



Author: carlosg
Date: Fri Aug 29 13:25:26 2008
New Revision: 2187
URL: http://svn.gnome.org/viewvc/tracker?rev=2187&view=rev

Log:
2008-08-29  Carlos Garnacho  <carlos imendio com>

        * src/libtracker-db/tracker-db-index.c (tracker_db_index_flush): Do
        not use GHashTableIter API here, we can't avoid for sure having other
        portions of the code try to insert data to the index cache while it's
        flushing, and performance here is largely bound to QDBM, so it won't
        be that noticeable anyways.


Modified:
   branches/indexer-split/ChangeLog
   branches/indexer-split/src/libtracker-db/tracker-db-index.c

Modified: branches/indexer-split/src/libtracker-db/tracker-db-index.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-index.c	(original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-index.c	Fri Aug 29 13:25:26 2008
@@ -865,21 +865,25 @@
 	removed_items = 0;
 
 	if (size > 0) {
-		GHashTableIter iter;
-		gpointer       key, value;
+		GList *keys, *k;
+		gpointer value;
 
 		g_debug ("Flushing index with %d items in cache", size);
 
-		g_hash_table_iter_init (&iter, priv->cache);
+		keys = g_hash_table_get_keys (priv->cache);
 
-		while (g_hash_table_iter_next (&iter, &key, &value) && !priv->in_pause) {
-			if (cache_flush_item (key, value, priv->index)) {
-				g_hash_table_iter_remove (&iter);
+		for (k = keys; k; k = k->next) {
+			value = g_hash_table_lookup (priv->cache, k->data);
+
+			if (cache_flush_item (k->data, value, priv->index)) {
+				g_hash_table_remove (priv->cache, k->data);
 				removed_items++;
 			}
 
 			g_main_context_iteration (NULL, FALSE);
 		}
+
+		g_list_free (keys);
 	}
 
 	priv->in_flush = FALSE;



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