tracker r1169 - trunk/src/trackerd
- From: jamiemcc svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r1169 - trunk/src/trackerd
- Date: Thu, 28 Feb 2008 02:21:52 +0000 (GMT)
Author: jamiemcc
Date: Thu Feb 28 02:21:52 2008
New Revision: 1169
URL: http://svn.gnome.org/viewvc/tracker?rev=1169&view=rev
Log:
fixed an dimproved blacklisting
Modified:
trunk/src/trackerd/tracker-db.c
trunk/src/trackerd/tracker-dbus.c
trunk/src/trackerd/tracker-utils.c
trunk/src/trackerd/trackerd.c
Modified: trunk/src/trackerd/tracker-db.c
==============================================================================
--- trunk/src/trackerd/tracker-db.c (original)
+++ trunk/src/trackerd/tracker-db.c Thu Feb 28 02:21:52 2008
@@ -1,7 +1,7 @@
/* Tracker - indexer and metadata database engine
* Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
* Copyright (C) 2007, Jason Kivlighn (jkivlighn gmail com)
- * Copyright (C) 2007, Creative Commons (http://creativecommons.org)
+ * Copyright (C) 2007, Creative Commons (http://creativecommons.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
@@ -34,8 +34,9 @@
#define XMP_MIME_TYPE "application/rdf+xml"
#define STACK_SIZE 30
-#define MAX_DURATION 300
-#define MAX_CHANGE_TIMES 4
+#define BLACK_LIST_SECONDS 3600
+#define MAX_DURATION 180
+#define MAX_CHANGE_TIMES 3
typedef struct {
DBConnection *db_con;
@@ -600,7 +601,7 @@
count = 1;
for (l = g_list_first (head); l != NULL; l = g_list_next (l)) {
change = (FileChange*)l->data;
- tracker_log ("%d\t%s\t%d\t%d",
+ tracker_info ("%d\t%s\t%d\t%d",
count++, change->uri,
change->first_change_time,
change->num_of_change);
@@ -638,9 +639,11 @@
g_slist_free (tracker->tmp_black_list);
+ tracker->tmp_black_list = NULL;
+
tracker->black_list_timer_active = FALSE;
- return TRUE;
+ return FALSE;
}
@@ -667,6 +670,7 @@
find = g_queue_find_custom (tracker->file_change_queue, uri, uri_comp);
if (!find) {
/* not found, add to in the queue */
+
change = g_new0 (FileChange, 1);
change->uri = g_strdup (uri);
change->first_change_time = current;
@@ -693,11 +697,13 @@
/* add uri to blacklist */
+ tracker_log ("blacklisting %s", change->uri);
+
tracker->tmp_black_list = g_slist_prepend (tracker->tmp_black_list, g_strdup (change->uri));
if (!tracker->black_list_timer_active) {
tracker->black_list_timer_active = TRUE;
- g_timeout_add_seconds (3600, (GSourceFunc) index_black_list, NULL);
+ g_timeout_add_seconds (BLACK_LIST_SECONDS, (GSourceFunc) index_black_list, NULL);
}
g_queue_remove_all (tracker->file_change_queue, change);
@@ -718,7 +724,7 @@
/* check if uri changed too frequently */
if (((action == TRACKER_ACTION_CHECK) ||
- (action == TRACKER_ACTION_FILE_CHECK)) &&
+ (action == TRACKER_ACTION_FILE_CHECK) || (action == TRACKER_ACTION_WRITABLE_FILE_CLOSED)) &&
check_uri_changed_frequently (uri)) {
return;
Modified: trunk/src/trackerd/tracker-dbus.c
==============================================================================
--- trunk/src/trackerd/tracker-dbus.c (original)
+++ trunk/src/trackerd/tracker-dbus.c Thu Feb 28 02:21:52 2008
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include "tracker-dbus.h"
#include "tracker-utils.h"
+#include "tracker-watch.h"
extern Tracker *tracker;
Modified: trunk/src/trackerd/tracker-utils.c
==============================================================================
--- trunk/src/trackerd/tracker-utils.c (original)
+++ trunk/src/trackerd/tracker-utils.c Thu Feb 28 02:21:52 2008
@@ -2305,8 +2305,11 @@
GSList *lst;
for (lst = tracker->tmp_black_list; lst; lst = lst->next) {
+
char *compare_uri = lst->data;
+ if (!compare_uri) continue;
+
if (strcmp (uri, compare_uri) == 0) {
g_free (name);
return TRUE;
Modified: trunk/src/trackerd/trackerd.c
==============================================================================
--- trunk/src/trackerd/trackerd.c (original)
+++ trunk/src/trackerd/trackerd.c Thu Feb 28 02:21:52 2008
@@ -349,6 +349,32 @@
free_file_change (&change);
}
+
+static void
+reset_blacklist_file (char *uri)
+{
+
+ char *parent = g_path_get_dirname (uri);
+ if (!parent) return;
+
+ char *parent_name = g_path_get_basename (parent);
+ if (!parent_name) return;
+
+ char *parent_path = g_path_get_dirname (parent);
+ if (!parent_path) return;
+
+ tracker_log ("resetting black list file %s", uri);
+
+ /* reset mtime on parent folder of all outstanding black list files so they get indexed when next restarted */
+ tracker_exec_proc (main_thread_db_con, "UpdateFileMTime", 3, "0", parent_path, parent_name);
+
+ g_free (parent);
+ g_free (parent_name);
+ g_free (parent_path);
+
+
+}
+
gboolean
tracker_do_cleanup (const gchar *sig_msg)
{
@@ -432,6 +458,10 @@
/* reset integrity status as threads have closed cleanly */
tracker_db_set_option_int (main_thread_db_con, "IntegrityCheck", 0);
+
+
+ /* reset black list files */
+ g_slist_foreach (tracker->tmp_black_list, (GFunc) reset_blacklist_file, NULL);
tracker_db_close (main_thread_db_con);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]