[tracker/batch-signal: 2/4] tracker-store: Stop signal timeout after an immediate emission



commit 46f5e5c3e1c5face996b2a8b662110e5b5a6b14f
Author: Jürg Billeter <j bitron ch>
Date:   Tue May 10 15:04:29 2011 +0200

    tracker-store: Stop signal timeout after an immediate emission

 src/tracker-store/tracker-resources.vala |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/tracker-store/tracker-resources.vala b/src/tracker-store/tracker-resources.vala
index 9bdbc6e..0d8aea9 100644
--- a/src/tracker-store/tracker-resources.vala
+++ b/src/tracker-store/tracker-resources.vala
@@ -278,13 +278,16 @@ public class Tracker.Resources : Object {
 	void check_graph_updated_signal () {
 		/* Check for whether we need an immediate emit */
 		if (Tracker.Events.get_total (false) > GRAPH_UPDATED_IMMEDIATE_EMIT_AT) {
-
-			foreach (var cl in Tracker.Events.get_classes ()) {
-				emit_graph_updated (cl);
+			// possibly active timeout no longer necessary as signals
+			// for committed transactions will be emitted by the following on_emit_signals call
+			// do this before actually calling on_emit_signals as on_emit_signals sets signal_timeout to 0
+			if (signal_timeout != 0) {
+				Source.remove (signal_timeout);
+				signal_timeout = 0;
 			}
 
-			/* Reset counter */
-			Tracker.Events.get_total (true);
+			// immediately emit signals for already committed transaction
+			on_emit_signals ();
 		}
 	}
 



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