[tracker/rss-enclosures] Add support for TRACKER_STORE_TASK_MAX_TIME environment variable for setting the maximum time allowe
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] Add support for TRACKER_STORE_TASK_MAX_TIME environment variable for setting the maximum time allowe
- Date: Sat, 26 Jun 2010 23:13:03 +0000 (UTC)
commit e332dd74bb85ef453a2fa31e678be48a3fc3b1c2
Author: Mikael Ottela <mikael ottela ixonos com>
Date: Wed Jun 2 11:15:54 2010 +0300
Add support for TRACKER_STORE_TASK_MAX_TIME environment variable for setting
the maximum time allowed before interrupting the query. This is for testing purposes.
docs/manpages/tracker-store.1 | 7 +++++++
src/tracker-store/tracker-store.c | 11 ++++++++++-
2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/docs/manpages/tracker-store.1 b/docs/manpages/tracker-store.1
index 50dbdb4..8747bff 100644
--- a/docs/manpages/tracker-store.1
+++ b/docs/manpages/tracker-store.1
@@ -74,6 +74,13 @@ This is the directory which tracker uses to load the stop words
dictionaries from. If unset it will default to the correct place. This
is used mainly for testing purposes.
+.TP
+.B TRACKER_STORE_MAX_TASK_TIME
+This is maximum time allowed for a process to finish before interruption
+happens. The actual moment of interruption depends also on the frequency of
+checks. The value 0 indicates no interruption.
+This environment variable is used mainly for testing purposes.
+
.SH FILES
.I $HOME/.config/tracker/tracker-store.cfg
.I $HOME/.config/tracker/tracker-fts.cfg
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index 495e874..a2f53ab 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -53,6 +53,7 @@ typedef struct {
GThreadPool *global_pool;
GSList *running_tasks;
guint watchdog_id;
+ guint max_task_time;
} TrackerStorePrivate;
typedef enum {
@@ -303,7 +304,8 @@ watchdog_cb (gpointer user_data)
running = running->next;
thread = task->data.query.running_thread;
- if (thread && g_timer_elapsed (task->data.query.timer, NULL) > TRACKER_STORE_MAX_TASK_TIME) {
+ if (thread && private->max_task_time &&
+ g_timer_elapsed (task->data.query.timer, NULL) > private->max_task_time) {
tracker_data_manager_interrupt_thread (task->data.query.running_thread);
}
}
@@ -598,9 +600,16 @@ tracker_store_init (void)
{
TrackerStorePrivate *private;
gint i;
+ const char *tmp;
private = g_new0 (TrackerStorePrivate, 1);
+ if ((tmp = g_getenv("TRACKER_STORE_MAX_TASK_TIME")) != NULL) {
+ private->max_task_time = atoi (tmp);
+ } else {
+ private->max_task_time = TRACKER_STORE_MAX_TASK_TIME;
+ }
+
for (i = 0; i < TRACKER_STORE_N_PRIORITIES; i++) {
private->queues[i] = g_queue_new ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]