[tracker/tracker-store] Improved the end_batch time for the push modules.



commit 734a904ac209b4fa507c2086d08248171b548931
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Jun 15 12:43:19 2009 +0200

    Improved the end_batch time for the push modules.
    
    The modseq was a rather bad indicator to commit the batch. Instead is the
    length of the SetMany() requests now used.

 .../evolution/tracker-evolution-registrar.c        |   10 +++++-----
 src/plugins/kmail/tracker-kmail-registrar.c        |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/plugins/evolution/tracker-evolution-registrar.c b/src/plugins/evolution/tracker-evolution-registrar.c
index 25dc054..31b5d07 100644
--- a/src/plugins/evolution/tracker-evolution-registrar.c
+++ b/src/plugins/evolution/tracker-evolution-registrar.c
@@ -76,7 +76,7 @@ enum {
 
 
 typedef struct {
-	guint modseq;
+	guint modseq, item_no, reached;
 	gchar *subject;
 	GStrv predicates;
 	GStrv values;
@@ -667,7 +667,7 @@ queued_set_free (QueuedSet *queued_set)
 static gboolean 
 many_idle_handler (gpointer user_data)
 {
-	guint i, last_modseq = 0;
+	guint i;
 	QueuedSet *queued_set = GUINT_TO_POINTER (1);
 	TrackerEvolutionRegistrar *object = user_data;
 
@@ -680,14 +680,12 @@ many_idle_handler (gpointer user_data)
 			             queued_set->predicates,
 			             queued_set->values);
 
-			if (last_modseq != queued_set->modseq) {
+			if (queued_set->item_no == queued_set->reached) {
 				tracker_store_queue_commit (on_commit, 
 				                            GUINT_TO_POINTER (queued_set->modseq), 
 				                            NULL);
 			}
 
-			last_modseq = queued_set->modseq;
-
 			queued_set_free (queued_set);
 		} 
 	}
@@ -745,6 +743,8 @@ tracker_evolution_registrar_set_many (TrackerEvolutionRegistrar *object,
 		queued_set->predicates = g_strdupv (g_ptr_array_index (predicates, i));
 		queued_set->values = g_strdupv (g_ptr_array_index (values, i));
 		queued_set->modseq = modseq;
+		queued_set->item_no = i;
+		queued_set->reached = len - 1;
 
 		g_queue_push_tail (many_queue, queued_set);
 
diff --git a/src/plugins/kmail/tracker-kmail-registrar.c b/src/plugins/kmail/tracker-kmail-registrar.c
index ee5fd4e..fdf555f 100644
--- a/src/plugins/kmail/tracker-kmail-registrar.c
+++ b/src/plugins/kmail/tracker-kmail-registrar.c
@@ -74,7 +74,7 @@ enum {
 
 
 typedef struct {
-	guint modseq;
+	guint modseq, item_no, reached;
 	gchar *subject;
 	GStrv predicates;
 	GStrv values;
@@ -431,7 +431,7 @@ queued_set_free (QueuedSet *queued_set)
 static gboolean 
 many_idle_handler (gpointer user_data)
 {
-	guint i, last_modseq = 0;
+	guint i;
 	QueuedSet *queued_set = GUINT_TO_POINTER (1);
 	TrackerKMailRegistrar *object = user_data;
 
@@ -444,14 +444,12 @@ many_idle_handler (gpointer user_data)
 			             queued_set->predicates,
 			             queued_set->values);
 
-			if (last_modseq != queued_set->modseq) {
+			if (queued_set->item_no == queued_set->reached) {
 				tracker_store_queue_commit (on_commit, 
 				                            GUINT_TO_POINTER (queued_set->modseq), 
 				                            NULL);
 			}
 
-			last_modseq = queued_set->modseq;
-
 			queued_set_free (queued_set);
 		} 
 	}
@@ -509,6 +507,8 @@ tracker_kmail_registrar_set_many (TrackerKMailRegistrar *object,
 		queued_set->predicates = g_strdupv (g_ptr_array_index (predicates, i));
 		queued_set->values = g_strdupv (g_ptr_array_index (values, i));
 		queued_set->modseq = modseq;
+		queued_set->item_no = i;
+		queued_set->reached = len - 1;
 
 		g_queue_push_tail (many_queue, queued_set);
 



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