[gnome-photos/wip/rishi/import-2: 2/6] item-manager: Log the URIs that are being watched for updates



commit b8dba30df27ffac5a6675f4d183a3e08ec1cd8ce
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Feb 10 00:28:55 2018 +0100

    item-manager: Log the URIs that are being watched for updates
    
    Trying to detect when the metadata for a URI has been inserted or
    updated in Tracker's database by looking for relevant GraphUpdated
    emissions seems fragile. When files are copied in bulk, sometimes, a
    GraphUpdated goes missing, or is apparently emitted so early that the
    entry in the database doesn't yet have a URI, which means that the URN
    can't be matched to its URI.
    
    The reasons are not known, but one can imagine that variations in
    timing and possible software bugs across the multiple layers involved
    in this mechanism contribute to this problem. Having some logging makes
    it easier to debug when this happens.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/issues/29

 src/photos-item-manager.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 1fab4770..20935fae 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -30,6 +30,7 @@
 #include <tracker-sparql.h>
 
 #include "egg-counter.h"
+#include "photos-debug.h"
 #include "photos-enums.h"
 #include "photos-filterable.h"
 #include "photos-item-manager.h"
@@ -344,6 +345,8 @@ photos_item_manager_check_wait_for_changes (PhotosItemManager *self, const gchar
   g_return_if_fail (id != NULL && id[0] != '\0');
   g_return_if_fail (uri != NULL && uri[0] != '\0');
 
+  photos_debug (PHOTOS_DEBUG_TRACKER, "Detected changes to %s", uri);
+
   tasks = (GList *) g_hash_table_lookup (self->wait_for_changes_table, uri);
   for (l = tasks; l != NULL; l = l->next)
     {
@@ -1259,6 +1262,8 @@ photos_item_manager_wait_for_changes_async (PhotosItemManager *self,
   tasks = g_list_prepend (tasks, g_object_ref (task));
   g_hash_table_insert (self->wait_for_changes_table, g_strdup (uri), tasks);
 
+  photos_debug (PHOTOS_DEBUG_TRACKER, "Waiting for %s", uri);
+
  out:
   return;
 }


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