tracker r2816 - in trunk: . src/libtracker-common src/trackerd



Author: carlosg
Date: Wed Jan 21 16:30:49 2009
New Revision: 2816
URL: http://svn.gnome.org/viewvc/tracker?rev=2816&view=rev

Log:
2009-01-21  Carlos Garnacho  <carlos imendio com>

        * src/libtracker-common/tracker-module-config.[ch]: Add support for
        ScanTimeout option, which forces such timeout (in seconds) after a
        file pertaining to the module has changed before being sent to the
        indexer.

        * src/trackerd/tracker-monitor.c
        (libinotify_cached_events_timeout_cb): Wait for the specified timeout
        before sending files to the indexer.

        * data/modules/evolution.module: Schedule reindexing of mails to 1h
        after the files change.

Modified:
   trunk/ChangeLog
   trunk/src/libtracker-common/tracker-module-config.c
   trunk/src/libtracker-common/tracker-module-config.h
   trunk/src/trackerd/tracker-monitor.c

Modified: trunk/src/libtracker-common/tracker-module-config.c
==============================================================================
--- trunk/src/libtracker-common/tracker-module-config.c	(original)
+++ trunk/src/libtracker-common/tracker-module-config.c	Wed Jan 21 16:30:49 2009
@@ -57,6 +57,7 @@
 	GHashTable *index_mime_types;
 	GHashTable *index_files;
 	GList	   *index_file_patterns;
+	guint       scan_timeout;
 
 	/* Specific Options, FIXME: Finish */
 
@@ -266,6 +267,31 @@
 	return boolean;
 }
 
+static gint
+load_int (GKeyFile    *key_file,
+	  const gchar *group,
+	  const gchar *key)
+{
+	GError *error = NULL;
+	gint val;
+
+	val = g_key_file_get_integer (key_file, group, key, &error);
+
+	if (error) {
+		g_message ("Couldn't load module config integer in "
+			   "group:'%s' with key:'%s', %s",
+			   group,
+			   key,
+			   error->message);
+
+		g_error_free (error);
+
+		return 0;
+	}
+
+	return val;
+}
+
 static gchar *
 load_string (GKeyFile	 *key_file,
 	      const gchar *group,
@@ -450,6 +476,9 @@
 					    "Files",
 					    FALSE,
 					    FALSE);
+	mc->scan_timeout = load_int (key_file,
+				     GROUP_INDEX,
+				     "ScanTimeout");
 
 	check_for_monitor_directory_conflicts (mc);
 
@@ -775,6 +804,19 @@
 	return g_hash_table_get_keys (mc->index_files);
 }
 
+gint
+tracker_module_config_get_scan_timeout (const gchar *name)
+{
+	ModuleConfig *mc;
+
+	g_return_val_if_fail (name != NULL, 0);
+
+	mc = g_hash_table_lookup (modules, name);
+	g_return_val_if_fail (mc, 0);
+
+	return mc->scan_timeout;
+}
+
 /*
  * Convenience functions
  */

Modified: trunk/src/libtracker-common/tracker-module-config.h
==============================================================================
--- trunk/src/libtracker-common/tracker-module-config.h	(original)
+++ trunk/src/libtracker-common/tracker-module-config.h	Wed Jan 21 16:30:49 2009
@@ -46,6 +46,7 @@
 const gchar *tracker_module_config_get_index_service		   (const gchar *name);
 GList *      tracker_module_config_get_index_mime_types		   (const gchar *name);
 GList *      tracker_module_config_get_index_files		   (const gchar *name);
+gint         tracker_module_config_get_scan_timeout                (const gchar *name);
 
 /* Convenience functions */
 GList *      tracker_module_config_get_ignored_directory_patterns  (const gchar *name);

Modified: trunk/src/trackerd/tracker-monitor.c
==============================================================================
--- trunk/src/trackerd/tracker-monitor.c	(original)
+++ trunk/src/trackerd/tracker-monitor.c	Wed Jan 21 16:30:49 2009
@@ -1118,7 +1118,11 @@
 			 seconds_then,
 			 seconds);
 
-		if (seconds < 2) {
+		module_name = get_module_name_from_gfile (monitor,
+							  event->file,
+							  &is_directory);
+
+		if (seconds < MAX (2, tracker_module_config_get_scan_timeout (module_name))) {
 			continue;
 		}
 
@@ -1130,10 +1134,6 @@
 			 event->event_type,
 			 seconds);
 
-		module_name = get_module_name_from_gfile (monitor,
-							  event->file,
-							  &is_directory);
-
 		switch (event->event_type) {
 		case IN_MODIFY:
 		case IN_CLOSE_WRITE:



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