[tracker/miner-fs-initial-sleep] tracker-miner-fs: Perform initial-sleep in all miners as given by the config



commit 79736efe1ea2962e9ff258e48dfb91dd41964336
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Mar 24 09:32:48 2011 +0100

    tracker-miner-fs: Perform initial-sleep in all miners as given by the config
    
    Fixes GB#644997

 src/miners/fs/tracker-main.c |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 3f2317e..10d126f 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -271,6 +271,38 @@ miner_handle_next (void)
 	}
 }
 
+static gboolean
+miner_handle_first_cb (gpointer data)
+{
+	miner_handle_next ();
+	return FALSE;
+}
+
+static void
+miner_handle_first (TrackerConfig *config)
+{
+	gint initial_sleep;
+
+	/* If requesting to run as no-daemon, start right away */
+	if (no_daemon) {
+		miner_handle_next ();
+		return;
+	}
+
+	/* If no need to initially sleep, start right away */
+	initial_sleep = tracker_config_get_initial_sleep (config);
+	if (initial_sleep <= 0) {
+		miner_handle_next ();
+		return;
+	}
+
+	g_debug ("Performing initial sleep of %d seconds",
+	         initial_sleep);
+	g_timeout_add_seconds (initial_sleep,
+	                       miner_handle_first_cb,
+	                       NULL);
+}
+
 static void
 miner_finished_cb (TrackerMinerFS *fs,
                    gdouble         seconds_elapsed,
@@ -715,7 +747,7 @@ main (gint argc, gchar *argv[])
 
 	tracker_thumbnailer_init ();
 
-	miner_handle_next ();
+	miner_handle_first (config);
 
 	/* Go, go, go! */
 	g_main_loop_run (main_loop);



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