[tracker-miners/wip/carlosg/tracker-3.0-api-breaks: 12/25] tracker-miner-fs: Fetch SPARQL connection from miner



commit 6a381b8cdbb6ab8dd7d63cd5593af49b4e6eb885
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Dec 31 01:47:03 2019 +0100

    tracker-miner-fs: Fetch SPARQL connection from miner
    
    The default SPARQL connection might not be that of the miner's.
    This way we are ensured to use a consistent one across the whole
    process.

 src/miners/fs/tracker-miner-files-index.c    | 11 +----------
 src/miners/fs/tracker-writeback-dispatcher.c |  8 +-------
 src/miners/fs/tracker-writeback-listener.c   |  8 +-------
 3 files changed, 3 insertions(+), 24 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files-index.c b/src/miners/fs/tracker-miner-files-index.c
index 942e50162..bb5ea164f 100644
--- a/src/miners/fs/tracker-miner-files-index.c
+++ b/src/miners/fs/tracker-miner-files-index.c
@@ -247,7 +247,6 @@ tracker_miner_files_index_reindex_mime_types (TrackerMinerFilesIndex *miner,
 {
        TrackerMinerFilesIndexPrivate *priv;
        GString *query;
-       GError *inner_error = NULL;
        TrackerSparqlConnection *connection;
        TrackerDBusRequest *request;
        gint len, i;
@@ -265,15 +264,7 @@ tracker_miner_files_index_reindex_mime_types (TrackerMinerFilesIndex *miner,
                                                __FUNCTION__,
                                                len);
 
-       connection = tracker_sparql_connection_get (NULL, &inner_error);
-
-       if (!connection) {
-               g_free (mime_types);
-               tracker_dbus_request_end (request, inner_error);
-               g_dbus_method_invocation_return_gerror (invocation, inner_error);
-               g_error_free (inner_error);
-               return;
-       }
+       connection = tracker_miner_get_connection (TRACKER_MINER (priv->files_miner));
 
        tracker_dbus_request_comment (request,
                                      "Attempting to reindex the following mime types:");
diff --git a/src/miners/fs/tracker-writeback-dispatcher.c b/src/miners/fs/tracker-writeback-dispatcher.c
index 2d846b6ba..0a2d45a51 100644
--- a/src/miners/fs/tracker-writeback-dispatcher.c
+++ b/src/miners/fs/tracker-writeback-dispatcher.c
@@ -179,13 +179,7 @@ writeback_dispatcher_initable_init (GInitable    *initable,
        GError *internal_error = NULL;
 
        priv = TRACKER_WRITEBACK_DISPATCHER_GET_PRIVATE (initable);
-
-       priv->connection = tracker_sparql_connection_get (NULL, &internal_error);
-
-       if (internal_error) {
-               g_propagate_error (error, internal_error);
-               return FALSE;
-       }
+       priv->connection = tracker_miner_get_connection (TRACKER_MINER (priv->files_miner));
 
        priv->d_connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &internal_error);
 
diff --git a/src/miners/fs/tracker-writeback-listener.c b/src/miners/fs/tracker-writeback-listener.c
index b70c6b1e1..43d3d9646 100644
--- a/src/miners/fs/tracker-writeback-listener.c
+++ b/src/miners/fs/tracker-writeback-listener.c
@@ -208,13 +208,7 @@ writeback_listener_initable_init (GInitable    *initable,
        GError *internal_error = NULL;
 
        priv = tracker_writeback_listener_get_instance_private (listener);
-
-       priv->connection = tracker_sparql_connection_get (NULL, &internal_error);
-
-       if (internal_error) {
-               g_propagate_error (error, internal_error);
-               return FALSE;
-       }
+       priv->connection = tracker_miner_get_connection (TRACKER_MINER (priv->files_miner));
 
        priv->d_connection = g_bus_get_sync (TRACKER_IPC_BUS, NULL, &internal_error);
 


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