[tracker] Make it possible to configure the delay for GraphUpdated
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] Make it possible to configure the delay for GraphUpdated
- Date: Thu, 9 Jan 2014 13:22:03 +0000 (UTC)
commit 553730af84f4ce5e33f1fba51ff466cb3b9740f2
Author: Philip Van Hoof <philip codeminded be>
Date: Sat Nov 23 10:28:35 2013 +0100
Make it possible to configure the delay for GraphUpdated
Helps fixing JB# 11570
.../org.freedesktop.Tracker.Store.gschema.xml.in | 5 ++
src/tracker-store/tracker-config.c | 40 ++++++++++++++++++++
src/tracker-store/tracker-config.h | 5 ++
src/tracker-store/tracker-config.vapi | 1 +
src/tracker-store/tracker-dbus.vala | 6 ++-
src/tracker-store/tracker-main.vala | 3 +-
src/tracker-store/tracker-resources.vala | 7 ++-
7 files changed, 61 insertions(+), 6 deletions(-)
---
diff --git a/data/gschemas/org.freedesktop.Tracker.Store.gschema.xml.in
b/data/gschemas/org.freedesktop.Tracker.Store.gschema.xml.in
index bd4ac8d..f7c4565 100644
--- a/data/gschemas/org.freedesktop.Tracker.Store.gschema.xml.in
+++ b/data/gschemas/org.freedesktop.Tracker.Store.gschema.xml.in
@@ -24,5 +24,10 @@ Boston, MA 02110-1301, USA.
<_summary>Log verbosity</_summary>
<_description>Log verbosity.</_description>
</key>
+ <key name="graphupdated-delay" type="i">
+ <default>1000</default>
+ <_summary>GraphUpdated delay</_summary>
+ <_description>Delay in ms. at which GraphUpdated will happen when signalling data is
available.</_description>
+ </key>
</schema>
</schemalist>
diff --git a/src/tracker-store/tracker-config.c b/src/tracker-store/tracker-config.c
index 889c40c..419aecb 100644
--- a/src/tracker-store/tracker-config.c
+++ b/src/tracker-store/tracker-config.c
@@ -45,10 +45,12 @@ static void config_constructed (GObject *object);
enum {
PROP_0,
PROP_VERBOSITY,
+ PROP_GRAPHUPDATED_DELAY,
};
static TrackerConfigMigrationEntry migration[] = {
{ G_TYPE_ENUM, "General", "Verbosity", "verbosity", FALSE, FALSE },
+ { G_TYPE_INT, "General", "GraphUpdatedDelay", "graphupdated-delay" },
{ 0 }
};
@@ -72,6 +74,17 @@ tracker_config_class_init (TrackerConfigClass *klass)
TRACKER_TYPE_VERBOSITY,
TRACKER_VERBOSITY_ERRORS,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_GRAPHUPDATED_DELAY,
+ g_param_spec_int ("graphupdated-delay",
+ "GraphUpdated delay",
+ "GraphUpdated delay in ms. (1000)",
+ 0,
+ G_MAXINT,
+ 1000,
+ G_PARAM_READWRITE));
+
}
static void
@@ -86,6 +99,11 @@ config_set_property (GObject *object,
GParamSpec *pspec)
{
switch (param_id) {
+ case PROP_GRAPHUPDATED_DELAY:
+ tracker_config_set_graphupdated_delay (TRACKER_CONFIG (object),
+ g_value_get_int (value));
+ break;
+
case PROP_VERBOSITY:
tracker_config_set_verbosity (TRACKER_CONFIG (object),
g_value_get_enum (value));
@@ -103,6 +121,10 @@ config_get_property (GObject *object,
GParamSpec *pspec)
{
switch (param_id) {
+ case PROP_GRAPHUPDATED_DELAY:
+ g_value_set_int (value, tracker_config_get_graphupdated_delay (TRACKER_CONFIG (object)));
+ break;
+
/* General */
case PROP_VERBOSITY:
g_value_set_enum (value, tracker_config_get_verbosity (TRACKER_CONFIG (object)));
@@ -168,3 +190,21 @@ tracker_config_set_verbosity (TrackerConfig *config,
g_object_notify (G_OBJECT (config), "verbosity");
}
+
+gint
+tracker_config_get_graphupdated_delay (TrackerConfig *config)
+{
+ g_return_val_if_fail (TRACKER_IS_CONFIG (config), 0);
+
+ return g_settings_get_int (G_SETTINGS (config), "graphupdated-delay");
+}
+
+void
+tracker_config_set_graphupdated_delay (TrackerConfig *config,
+ gint value)
+{
+ g_return_if_fail (TRACKER_IS_CONFIG (config));
+
+ g_settings_set_int(G_SETTINGS (config), "graphupdated-delay", value);
+ g_object_notify (G_OBJECT (config), "graphupdated-delay");
+}
diff --git a/src/tracker-store/tracker-config.h b/src/tracker-store/tracker-config.h
index 17fd48c..d97f373 100644
--- a/src/tracker-store/tracker-config.h
+++ b/src/tracker-store/tracker-config.h
@@ -51,6 +51,11 @@ gint tracker_config_get_verbosity (TrackerConfi
void tracker_config_set_verbosity (TrackerConfig *config,
gint value);
+gint tracker_config_get_graphupdated_delay (TrackerConfig *config);
+
+void tracker_config_set_graphupdated_delay (TrackerConfig *config,
+ gint value);
+
G_END_DECLS
#endif /* __TRACKER_STORE_CONFIG_H__ */
diff --git a/src/tracker-store/tracker-config.vapi b/src/tracker-store/tracker-config.vapi
index e8d50b5..854a71c 100644
--- a/src/tracker-store/tracker-config.vapi
+++ b/src/tracker-store/tracker-config.vapi
@@ -22,5 +22,6 @@ namespace Tracker {
public class Config : ConfigFile {
public Config ();
public int verbosity { get; set; }
+ public int graphupdated_delay { get; set; }
}
}
diff --git a/src/tracker-store/tracker-dbus.vala b/src/tracker-store/tracker-dbus.vala
index 52b0365..96aed5f 100644
--- a/src/tracker-store/tracker-dbus.vala
+++ b/src/tracker-store/tracker-dbus.vala
@@ -34,6 +34,7 @@ public class Tracker.DBus {
static uint notifier_id;
static Tracker.Backup backup;
static uint backup_id;
+ static Tracker.Config config;
static bool dbus_register_service (string name) {
message ("Registering D-Bus service...\n Name:'%s'", name);
@@ -85,8 +86,9 @@ public class Tracker.DBus {
return true;
}
- public static bool init () {
+ public static bool init (Tracker.Config config_p) {
/* Don't reinitialize */
+ config = config_p;
if (connection != null) {
return true;
}
@@ -187,7 +189,7 @@ public class Tracker.DBus {
statistics_id = register_object (connection, statistics, Tracker.Statistics.PATH);
/* Add org.freedesktop.Tracker1.Resources */
- resources = new Tracker.Resources (connection);
+ resources = new Tracker.Resources (connection, config);
if (resources == null) {
critical ("Could not create TrackerResources object to register");
return false;
diff --git a/src/tracker-store/tracker-main.vala b/src/tracker-store/tracker-main.vala
index f8af0ac..ee0430d 100644
--- a/src/tracker-store/tracker-main.vala
+++ b/src/tracker-store/tracker-main.vala
@@ -56,6 +56,7 @@ License which can be viewed at:
static void sanity_check_option_values (Tracker.Config config) {
message ("General options:");
message (" Verbosity ............................ %d", config.verbosity);
+ message (" graphupdated-delay .................... %d", config.graphupdated_delay);
message ("Store options:");
message (" Readonly mode ........................ %s", readonly_mode ? "yes" : "no");
@@ -205,7 +206,7 @@ License which can be viewed at:
sanity_check_option_values (config);
- if (!Tracker.DBus.init ()) {
+ if (!Tracker.DBus.init (config)) {
return 1;
}
diff --git a/src/tracker-store/tracker-resources.vala b/src/tracker-store/tracker-resources.vala
index c5d3a82..f0c57b6 100644
--- a/src/tracker-store/tracker-resources.vala
+++ b/src/tracker-store/tracker-resources.vala
@@ -23,7 +23,6 @@ public class Tracker.Resources : Object {
public const string PATH = "/org/freedesktop/Tracker1/Resources";
const int GRAPH_UPDATED_IMMEDIATE_EMIT_AT = 50000;
- const int SIGNALS_SECONDS_PER_EMIT = 1;
/* I *know* that this is some arbitrary number that doesn't seem to
* resemble anything. In fact it's what I experimentally measured to
@@ -53,12 +52,14 @@ public class Tracker.Resources : Object {
DBusConnection connection;
uint signal_timeout;
bool regular_commit_pending;
+ Tracker.Config config;
public signal void writeback ([DBus (signature = "a{iai}")] Variant subjects);
public signal void graph_updated (string classname, [DBus (signature = "a(iiii)")] Variant deletes,
[DBus (signature = "a(iiii)")] Variant inserts);
- public Resources (DBusConnection connection) {
+ public Resources (DBusConnection connection, Tracker.Config config_p) {
this.connection = connection;
+ this.config = config_p;
}
public async void load (BusName sender, string uri) throws Error {
@@ -293,7 +294,7 @@ public class Tracker.Resources : Object {
if (regular_commit_pending || commit_type == Tracker.Data.CommitType.BATCH_LAST) {
// timer wanted for non-batch commits and the last in a series of batch commits
if (signal_timeout == 0) {
- signal_timeout = Timeout.add (SIGNALS_SECONDS_PER_EMIT * 1000,
on_emit_signals);
+ signal_timeout = Timeout.add (config.graphupdated_delay, on_emit_signals);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]