tracker r2103 - in branches/indexer-split: . src/libtracker-db src/tracker-indexer
- From: carlosg svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2103 - in branches/indexer-split: . src/libtracker-db src/tracker-indexer
- Date: Tue, 19 Aug 2008 13:00:43 +0000 (UTC)
Author: carlosg
Date: Tue Aug 19 13:00:43 2008
New Revision: 2103
URL: http://svn.gnome.org/viewvc/tracker?rev=2103&view=rev
Log:
2008-08-19 Carlos Garnacho <carlos imendio com>
* src/tracker-indexer/tracker-indexer.c: Emit the status signal every
10 seconds, as flushes now can be more sparse.
* src/libtracker-db/tracker-db-index.c (tracker_db_index_flush): Do
not try to flush if there aren't items in the cache.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/libtracker-db/tracker-db-index.c
branches/indexer-split/src/tracker-indexer/tracker-indexer.c
Modified: branches/indexer-split/src/libtracker-db/tracker-db-index.c
==============================================================================
--- branches/indexer-split/src/libtracker-db/tracker-db-index.c (original)
+++ branches/indexer-split/src/libtracker-db/tracker-db-index.c Tue Aug 19 13:00:43 2008
@@ -847,8 +847,9 @@
g_mutex_lock (priv->mutex);
}
- if (priv->index) {
- size = g_hash_table_size (priv->cache);
+ size = g_hash_table_size (priv->cache);
+
+ if (priv->index && size > 0) {
g_debug ("Flushing index with %d items in cache", size);
g_hash_table_foreach_remove (priv->cache,
Modified: branches/indexer-split/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/indexer-split/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/indexer-split/src/tracker-indexer/tracker-indexer.c Tue Aug 19 13:00:43 2008
@@ -79,6 +79,7 @@
#define FLUSH_FREQUENCY 60
#define LOW_DISK_CHECK_FREQUENCY 10
+#define SIGNAL_STATUS_FREQUENCY 10
/* Transaction every 'x' items */
#define TRANSACTION_MAX 2000
@@ -125,6 +126,7 @@
guint idle_id;
guint pause_for_duration_id;
guint disk_space_check_id;
+ guint signal_status_id;
guint flush_id;
guint files_processed;
@@ -397,6 +399,10 @@
g_source_remove (priv->disk_space_check_id);
}
+ if (priv->signal_status_id) {
+ g_source_remove (priv->signal_status_id);
+ }
+
if (priv->timer) {
g_timer_destroy (priv->timer);
}
@@ -677,6 +683,40 @@
}
}
+static gboolean
+signal_status_cb (TrackerIndexer *indexer)
+{
+ signal_status (indexer, "");
+ return TRUE;
+}
+
+static void
+signal_status_timeout_start (TrackerIndexer *indexer)
+{
+ TrackerIndexerPrivate *priv;
+
+ priv = indexer->private;
+
+ if (priv->signal_status_id == 0) {
+ priv->signal_status_id = g_timeout_add_seconds (SIGNAL_STATUS_FREQUENCY,
+ (GSourceFunc) signal_status_cb,
+ indexer);
+ }
+}
+
+static void
+signal_status_timeout_stop (TrackerIndexer *indexer)
+{
+ TrackerIndexerPrivate *priv;
+
+ priv = indexer->private;
+
+ if (priv->signal_status_id != 0) {
+ g_source_remove (priv->signal_status_id);
+ priv->signal_status_id = 0;
+ }
+}
+
static void
tracker_indexer_init (TrackerIndexer *indexer)
{
@@ -755,6 +795,7 @@
/* Set up idle handler to process files/directories */
check_started (indexer);
check_disk_space_start (indexer);
+ signal_status_timeout_start (indexer);
}
static void
@@ -1718,6 +1759,7 @@
if (!running) {
schedule_flush (indexer, TRUE);
check_disk_space_stop (indexer);
+ signal_status_timeout_stop (indexer);
g_source_remove (indexer->private->idle_id);
indexer->private->idle_id = 0;
@@ -1727,6 +1769,7 @@
g_signal_emit (indexer, signals[PAUSED], 0);
} else {
check_disk_space_start (indexer);
+ signal_status_timeout_start (indexer);
indexer->private->is_paused = FALSE;
indexer->private->idle_id = g_idle_add (process_func, indexer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]