tracker r2583 - in trunk: . src/trackerd



Author: mr
Date: Wed Nov 26 13:50:21 2008
New Revision: 2583
URL: http://svn.gnome.org/viewvc/tracker?rev=2583&view=rev

Log:


Modified:
   trunk/ChangeLog
   trunk/src/trackerd/tracker-cleanup.c
   trunk/src/trackerd/tracker-cleanup.h

Modified: trunk/src/trackerd/tracker-cleanup.c
==============================================================================
--- trunk/src/trackerd/tracker-cleanup.c	(original)
+++ trunk/src/trackerd/tracker-cleanup.c	Wed Nov 26 13:50:21 2008
@@ -25,9 +25,14 @@
 #include <libtracker-db/tracker-db-manager.h>
 #include <libtracker-data/tracker-data-update.h>
 
-#define MORE_THAN_A_DAY_OF_SECONDS 86400 + 60
+/* Deals with cleaning up resident data after longer timeouts (days,
+ * sessions).
+ */
+#define SECONDS_PER_DAY (60 * 60 * 24)
 
-/* Deals with cleaning up resident data after longer timeouts (days, sessions) */
+typedef struct {
+	guint timeout_id;
+} TrackerCleanupPrivate;
 
 static gboolean
 check_for_volumes_to_cleanup (gpointer user_data)
@@ -37,14 +42,16 @@
 
 	iface = tracker_db_manager_get_db_interface (TRACKER_DB_COMMON);
 
-	/* The stored statements of volume management have the "every one that 
-	 * is older than three days since their last unmount time" logic embed-
-	 * ded in the SQL statements. Take a look at sqlite-stored-procs.sql */
-
-	result_set = tracker_db_interface_execute_procedure (iface, NULL,
-					   "GetVolumesToClean",
-					   NULL);
-
+	/* The stored statements of volume management have the "every
+	 * one that is older than three days since their last unmount
+	 * time" logic embedded in the SQL statements. Take a look at
+	 * sqlite-stored-procs.sql.
+	 */
+	result_set = 
+		tracker_db_interface_execute_procedure (iface, NULL,
+							"GetVolumesToClean",
+							NULL);
+	
 	if (result_set) {
 		gboolean is_valid = TRUE;
 
@@ -71,11 +78,6 @@
 	return TRUE;
 }
 
-
-typedef struct {
-	guint     timeout_id;
-} TrackerCleanupPrivate;
-
 static GStaticPrivate private_key = G_STATIC_PRIVATE_INIT;
 
 static void
@@ -105,13 +107,16 @@
 
 	check_for_volumes_to_cleanup (private);
 
+	/* We use +1 because we want to make sure we trigger this
+	 * into the 4th day, not on the 3rd day. This guarantees at
+	 * least 3 days worth.
+	 */
 	private->timeout_id =
-		g_timeout_add_seconds (MORE_THAN_A_DAY_OF_SECONDS, 
+		g_timeout_add_seconds (SECONDS_PER_DAY + 1, 
 				       check_for_volumes_to_cleanup,
 				       private);
 }
 
-
 void tracker_cleanup_shutdown (void)
 {
 	g_static_private_set (&private_key, NULL, NULL);

Modified: trunk/src/trackerd/tracker-cleanup.h
==============================================================================
--- trunk/src/trackerd/tracker-cleanup.h	(original)
+++ trunk/src/trackerd/tracker-cleanup.h	Wed Nov 26 13:50:21 2008
@@ -21,7 +21,11 @@
 #ifndef __TRACKERD_CLEANUP_H__
 #define __TRACKERD_CLEANUP_H__
 
-void tracker_cleanup_init (void);
+G_BEGIN_DECLS
+
+void tracker_cleanup_init     (void);
 void tracker_cleanup_shutdown (void);
 
+G_END_DECLS
+
 #endif /* __TRACKERD_CLEANUP_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]