tracker r2050 - in branches/indexer-split: . src/trackerd
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2050 - in branches/indexer-split: . src/trackerd
- Date: Tue, 12 Aug 2008 11:56:52 +0000 (UTC)
Author: mr
Date: Tue Aug 12 11:56:52 2008
New Revision: 2050
URL: http://svn.gnome.org/viewvc/tracker?rev=2050&view=rev
Log:
* src/trackerd/tracker-daemon.c:
* src/trackerd/tracker-dbus.c: Don't resume indexing after the
dbus request without checking if we are manually paused or paused
for IO first.
* src/trackerd/tracker-monitor.c: Make sure we pause when we get
monitor events from the system.
* src/trackerd/tracker-crawler.c:
* src/trackerd/tracker-processor.c: Don't send ANYTHING to the
indexer or crawl any files while paused from IO as well as manually.
* src/trackerd/tracker-status.c: Make sure we send the right state
up to the applet about being paused from IO and for being on
battery.
Modified:
branches/indexer-split/ChangeLog
branches/indexer-split/src/trackerd/tracker-crawler.c
branches/indexer-split/src/trackerd/tracker-daemon.c
branches/indexer-split/src/trackerd/tracker-dbus.c
branches/indexer-split/src/trackerd/tracker-monitor.c
branches/indexer-split/src/trackerd/tracker-processor.c
branches/indexer-split/src/trackerd/tracker-status.c
Modified: branches/indexer-split/src/trackerd/tracker-crawler.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-crawler.c (original)
+++ branches/indexer-split/src/trackerd/tracker-crawler.c Tue Aug 12 11:56:52 2008
@@ -417,7 +417,8 @@
priv = crawler->private;
/* If manually paused, we hold off until unpaused */
- if (tracker_status_get_is_paused_manually ()) {
+ if (tracker_status_get_is_paused_manually () ||
+ tracker_status_get_is_paused_for_io ()) {
return TRUE;
}
Modified: branches/indexer-split/src/trackerd/tracker-daemon.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-daemon.c (original)
+++ branches/indexer-split/src/trackerd/tracker-daemon.c Tue Aug 12 11:56:52 2008
@@ -404,9 +404,12 @@
indexer_pause_cb,
NULL);
} else {
- org_freedesktop_Tracker_Indexer_continue_async (priv->indexer_proxy,
- indexer_continue_cb,
- NULL);
+ /* Don't continue if we are paused from IO */
+ if (!tracker_status_get_is_paused_for_io ()) {
+ org_freedesktop_Tracker_Indexer_continue_async (priv->indexer_proxy,
+ indexer_continue_cb,
+ NULL);
+ }
}
} else if (strcasecmp (option, "FastMerges") == 0) {
tracker_config_set_fast_merges (priv->config, value);
Modified: branches/indexer-split/src/trackerd/tracker-dbus.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-dbus.c (original)
+++ branches/indexer-split/src/trackerd/tracker-dbus.c Tue Aug 12 11:56:52 2008
@@ -176,9 +176,12 @@
proxy = user_data;
- org_freedesktop_Tracker_Indexer_continue_async (g_object_ref (proxy),
- indexer_continue_async_cb,
- NULL);
+ if (!tracker_status_get_is_paused_manually () &&
+ !tracker_status_get_is_paused_for_io ()) {
+ org_freedesktop_Tracker_Indexer_continue_async (g_object_ref (proxy),
+ indexer_continue_async_cb,
+ NULL);
+ }
return FALSE;
}
@@ -198,8 +201,9 @@
GError *error = NULL;
gboolean set_paused = TRUE;
- if (tracker_status_get () != TRACKER_STATUS_INDEXING)
+ if (tracker_status_get () != TRACKER_STATUS_INDEXING) {
return;
+ }
g_message ("New DBus request, checking indexer is paused...");
Modified: branches/indexer-split/src/trackerd/tracker-monitor.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-monitor.c (original)
+++ branches/indexer-split/src/trackerd/tracker-monitor.c Tue Aug 12 11:56:52 2008
@@ -29,6 +29,7 @@
#include "tracker-dbus.h"
#include "tracker-indexer-client.h"
#include "tracker-marshal.h"
+#include "tracker-status.h"
#define TRACKER_MONITOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_MONITOR, TrackerMonitorPrivate))
@@ -49,6 +50,12 @@
*/
#define BLACK_LIST_MAX_SECONDS 30
+/* When we receive IO monitor events, we pause sending information to
+ * the indexer for a few seconds before continuing. We have to receive
+ * NO events for at least a few seconds before unpausing.
+ */
+#define PAUSE_FOR_IO_SECONDS 5
+
struct _TrackerMonitorPrivate {
TrackerConfig *config;
@@ -70,6 +77,9 @@
* have to just use the _CHANGED event instead.
*/
gboolean use_changed_event;
+
+ /* Timeout id for pausing when we get IO */
+ guint unpause_timeout_id;
};
enum {
@@ -306,6 +316,10 @@
priv = TRACKER_MONITOR_GET_PRIVATE (object);
+ if (priv->unpause_timeout_id) {
+ g_source_remove (priv->unpause_timeout_id);
+ }
+
black_list_print_all (TRACKER_MONITOR (object));
g_hash_table_unref (priv->black_list_timestamps);
@@ -651,6 +665,51 @@
return "unknown";
}
+static void
+indexer_pause_cb (DBusGProxy *proxy,
+ GError *error,
+ gpointer user_data)
+{
+ if (error) {
+ g_message ("Could not pause the indexer, %s",
+ error->message);
+ }
+}
+
+static void
+indexer_continue_cb (DBusGProxy *proxy,
+ GError *error,
+ gpointer user_data)
+{
+ if (error) {
+ g_message ("Could not continue the indexer, %s",
+ error->message);
+ }
+}
+
+static gboolean
+unpause_cb (gpointer data)
+{
+ TrackerMonitor *monitor;
+
+ monitor = data;
+
+ monitor->private->unpause_timeout_id = 0;
+ tracker_status_set_is_paused_for_io (FALSE);
+
+ g_message ("Resumming indexing now we have stopped "
+ "receiving monitor events for %d seconds",
+ PAUSE_FOR_IO_SECONDS);
+
+ if (!tracker_status_get_is_paused_manually ()) {
+ org_freedesktop_Tracker_Indexer_continue_async (tracker_dbus_indexer_get_proxy (),
+ indexer_continue_cb,
+ NULL);
+ }
+
+ return FALSE;
+}
+
static void
monitor_event_cb (GFileMonitor *file_monitor,
GFile *file,
@@ -700,6 +759,24 @@
str2 ? str2 : "");
if (!black_list_file_check (monitor, file)) {
+ if (monitor->private->unpause_timeout_id != 0) {
+ g_source_remove (monitor->private->unpause_timeout_id);
+ } else {
+ g_message ("Pausing indexing because we are "
+ "receiving monitor events");
+
+ tracker_status_set_is_paused_for_io (TRUE);
+
+ org_freedesktop_Tracker_Indexer_pause_async (tracker_dbus_indexer_get_proxy (),
+ indexer_pause_cb,
+ NULL);
+ }
+
+ monitor->private->unpause_timeout_id =
+ g_timeout_add_seconds (PAUSE_FOR_IO_SECONDS,
+ unpause_cb,
+ monitor);
+
switch (event_type) {
case G_FILE_MONITOR_EVENT_CHANGED:
if (!monitor->private->use_changed_event) {
Modified: branches/indexer-split/src/trackerd/tracker-processor.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-processor.c (original)
+++ branches/indexer-split/src/trackerd/tracker-processor.c Tue Aug 12 11:56:52 2008
@@ -555,7 +555,8 @@
* events but we still queue them ready to send when we are
* unpaused.
*/
- if (tracker_status_get_is_paused_manually ()) {
+ if (tracker_status_get_is_paused_manually () ||
+ tracker_status_get_is_paused_for_io ()) {
g_message ("We are paused, sending nothing to the index until we are unpaused");
return TRUE;
}
Modified: branches/indexer-split/src/trackerd/tracker-status.c
==============================================================================
--- branches/indexer-split/src/trackerd/tracker-status.c (original)
+++ branches/indexer-split/src/trackerd/tracker-status.c Tue Aug 12 11:56:52 2008
@@ -224,10 +224,10 @@
if (private->is_first_time_index) {
pause_on_battery =
- tracker_config_get_disable_indexing_on_battery_init (private->config);
+ !tracker_config_get_disable_indexing_on_battery_init (private->config);
} else {
pause_on_battery =
- tracker_config_get_disable_indexing_on_battery (private->config);
+ !tracker_config_get_disable_indexing_on_battery (private->config);
}
g_signal_emit_by_name (object,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]