[tracker] libtracker-miner: Fully stop TrackerFileNotifier operations on errors



commit 6dd93a7ea2d3936f018d4ab4f630f9310ff13ea3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Dec 26 21:49:44 2016 +0100

    libtracker-miner: Fully stop TrackerFileNotifier operations on errors
    
    It oddly tried to just keep going, which may result in spurious deletes
    or partial inserts. Sounds better to just drop the ball on the directory
    at hand, it should be correctly indexed eventually.

 src/libtracker-miner/tracker-file-notifier.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 4d3ec24..5b1abe0 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -779,9 +779,11 @@ sparql_contents_query_cb (GObject      *object,
        cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (object),
                                                         result, &error);
        if (error) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-                       goto out;
-               g_warning ("Could not query directory contents: %s\n", error->message);
+               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                       g_warning ("Could not query directory contents: %s\n", error->message);
+                       finish_current_directory (notifier, TRUE);
+               }
+               goto out;
        }
 
        notifier = user_data;
@@ -865,17 +867,19 @@ sparql_files_query_cb (GObject      *object,
        GFile *directory;
        guint flags;
 
+       notifier = data->notifier;
+       priv = notifier->priv;
+
        cursor = tracker_sparql_connection_query_finish (TRACKER_SPARQL_CONNECTION (object),
                                                         result, &error);
        if (error) {
-               if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-                       goto out;
-               g_warning ("Could not query indexed files: %s\n", error->message);
+               if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+                       g_warning ("Could not query indexed files: %s\n", error->message);
+                       finish_current_directory (notifier, TRUE);
+               }
+               goto out;
        }
 
-       notifier = data->notifier;
-       priv = notifier->priv;
-
        if (cursor) {
                sparql_files_query_populate (notifier, cursor, TRUE);
                g_object_unref (cursor);


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