[tracker-miners/wip/carlosg/extraction-fixes: 6/8] tracker-extract: Insert SPARQL to ignore files that cause SPARQL errors




commit d5abe8ae46069fb93f13500e0fc1d534e071927e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Sep 30 18:09:22 2020 +0200

    tracker-extract: Insert SPARQL to ignore files that cause SPARQL errors
    
    Bubble the error up from TrackerDecorator, and handle it like the other
    failures in tracker-extract, so the file is reported, but doesn't sit
    there waiting to be picked up for extraction again.
    
    Now that we have "tracker3 status" and "tracker3 status $pattern", we
    can patiently wait for user bug reports without melting the poles.

 src/libtracker-miner/tracker-decorator.c        | 18 ++++++++++++++----
 src/libtracker-miner/tracker-decorator.h        |  5 ++++-
 src/tracker-extract/tracker-extract-decorator.c | 14 ++++++++++++++
 3 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-decorator.c b/src/libtracker-miner/tracker-decorator.c
index 685dfaaad..3bde1279b 100644
--- a/src/libtracker-miner/tracker-decorator.c
+++ b/src/libtracker-miner/tracker-decorator.c
@@ -101,6 +101,7 @@ enum {
 enum {
        ITEMS_AVAILABLE,
        FINISHED,
+       ERROR,
        LAST_SIGNAL
 };
 
@@ -261,11 +262,9 @@ retry_synchronously (TrackerDecorator *decorator,
                                                  &error);
 
                if (error) {
-                       GFile *file = g_file_new_for_uri (update->url);
-
-                       tracker_error_report (file, error->message, update->sparql);
+                       g_signal_emit (decorator, signals[ERROR], 0,
+                                      update->url, error->message, update->sparql);
                        g_error_free (error);
-                       g_object_unref (file);
                }
        }
 }
@@ -1069,6 +1068,17 @@ tracker_decorator_class_init (TrackerDecoratorClass *klass)
                              G_STRUCT_OFFSET (TrackerDecoratorClass, finished),
                              NULL, NULL, NULL,
                              G_TYPE_NONE, 0);
+
+       signals[ERROR] =
+               g_signal_new ("error",
+                             G_OBJECT_CLASS_TYPE (object_class),
+                             G_SIGNAL_RUN_LAST,
+                             G_STRUCT_OFFSET (TrackerDecoratorClass, error),
+                             NULL, NULL, NULL,
+                             G_TYPE_NONE, 3,
+                             G_TYPE_STRING,
+                             G_TYPE_STRING,
+                             G_TYPE_STRING);
 }
 
 static void
diff --git a/src/libtracker-miner/tracker-decorator.h b/src/libtracker-miner/tracker-decorator.h
index dcc5083b7..2059b013f 100644
--- a/src/libtracker-miner/tracker-decorator.h
+++ b/src/libtracker-miner/tracker-decorator.h
@@ -67,7 +67,10 @@ struct _TrackerDecoratorClass {
 
        void (* items_available) (TrackerDecorator *decorator);
        void (* finished)        (TrackerDecorator *decorator);
-
+       void (* error)           (TrackerDecorator *decorator,
+                                 const gchar      *url,
+                                 const gchar      *error_message,
+                                 const gchar      *sparql);
        /* <Private> */
        gpointer padding[10];
 };
diff --git a/src/tracker-extract/tracker-extract-decorator.c b/src/tracker-extract/tracker-extract-decorator.c
index 9e66f23cc..2a856acf4 100644
--- a/src/tracker-extract/tracker-extract-decorator.c
+++ b/src/tracker-extract/tracker-extract-decorator.c
@@ -390,6 +390,19 @@ tracker_extract_decorator_finished (TrackerDecorator *decorator)
        g_free (time_str);
 }
 
+static void
+tracker_extract_decorator_error (TrackerDecorator *decorator,
+                                 const gchar      *url,
+                                 const gchar      *error_message,
+                                 const gchar      *sparql)
+{
+       GFile *file;
+
+       file = g_file_new_for_uri (url);
+       decorator_ignore_file (file, TRACKER_EXTRACT_DECORATOR (decorator), error_message, sparql);
+       g_object_unref (file);
+}
+
 static void
 tracker_extract_decorator_class_init (TrackerExtractDecoratorClass *klass)
 {
@@ -406,6 +419,7 @@ tracker_extract_decorator_class_init (TrackerExtractDecoratorClass *klass)
 
        decorator_class->items_available = tracker_extract_decorator_items_available;
        decorator_class->finished = tracker_extract_decorator_finished;
+       decorator_class->error = tracker_extract_decorator_error;
 
        g_object_class_install_property (object_class,
                                         PROP_EXTRACTOR,


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