tracker r3012 - in trunk: . src/tracker-indexer
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r3012 - in trunk: . src/tracker-indexer
- Date: Tue, 3 Mar 2009 17:57:46 +0000 (UTC)
Author: carlosg
Date: Tue Mar 3 17:57:46 2009
New Revision: 3012
URL: http://svn.gnome.org/viewvc/tracker?rev=3012&view=rev
Log:
2009-03-03 Carlos Garnacho <carlos imendio com>
* src/tracker-indexer/tracker-indexer.[ch]: Make the indexer decide
the flush timeout dynamically based on the number of elements left.
Modified:
trunk/ChangeLog
trunk/src/tracker-indexer/tracker-indexer.c
trunk/src/tracker-indexer/tracker-indexer.h
Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c (original)
+++ trunk/src/tracker-indexer/tracker-indexer.c Tue Mar 3 17:57:46 2009
@@ -82,8 +82,9 @@
#define TRACKER_INDEXER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_INDEXER, TrackerIndexerPrivate))
-/* Flush every 'x' seconds */
-#define FLUSH_FREQUENCY 30
+#define FILES_REMAINING_THRESHOLD 10000
+#define MAX_FLUSH_FREQUENCY 60
+#define MIN_FLUSH_FREQUENCY 1
#define SIGNAL_STATUS_FREQUENCY 10
@@ -373,6 +374,18 @@
}
}
+static guint
+get_flush_time (TrackerIndexer *indexer)
+{
+ guint seconds, remaining_files;
+
+ remaining_files = g_queue_get_length (indexer->private->file_queue);
+
+ seconds = (remaining_files * MAX_FLUSH_FREQUENCY) / FILES_REMAINING_THRESHOLD;
+
+ return CLAMP (seconds, MIN_FLUSH_FREQUENCY, MAX_FLUSH_FREQUENCY);
+}
+
static void
schedule_flush (TrackerIndexer *indexer,
gboolean immediately)
@@ -393,7 +406,7 @@
return;
}
- indexer->private->flush_id = g_timeout_add_seconds (FLUSH_FREQUENCY,
+ indexer->private->flush_id = g_timeout_add_seconds (get_flush_time (indexer),
(GSourceFunc) flush_data,
indexer);
}
Modified: trunk/src/tracker-indexer/tracker-indexer.h
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.h (original)
+++ trunk/src/tracker-indexer/tracker-indexer.h Tue Mar 3 17:57:46 2009
@@ -31,7 +31,7 @@
#define TRACKER_INDEXER_INTERFACE "org.freedesktop.Tracker.Indexer"
/* Transaction every 'x' items */
-#define TRACKER_INDEXER_TRANSACTION_MAX 2000
+#define TRACKER_INDEXER_TRANSACTION_MAX 4000
G_BEGIN_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]