[tracker/sam/functional-test-fixes: 5/30] Set names of all our main loop sources



commit 864074e9e0dd6f65e74991f0222b7cedc8b0631c
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Jul 20 16:20:35 2014 +0100

    Set names of all our main loop sources
    
    This uses g_source_set_name_by_id(), available in GLib 2.26 and newer.
    
    This doesn't help track down 'Source ID %i was not found when attempting
    to remove it' errors, but it's nice to name them anyway.

 src/libtracker-common/tracker-dbus.c         |    1 +
 src/libtracker-common/tracker-storage.c      |    1 +
 src/libtracker-miner/tracker-crawler.c       |    1 +
 src/libtracker-miner/tracker-media-art.c     |    1 +
 src/libtracker-miner/tracker-miner-fs.c      |   19 +++++++++++--------
 src/libtracker-miner/tracker-monitor.c       |    4 ++++
 src/libtracker-miner/tracker-sparql-buffer.c |    7 ++++---
 src/miners/fs/tracker-main.c                 |    1 +
 src/miners/fs/tracker-miner-files.c          |    2 ++
 src/miners/fs/tracker-writeback-dispatcher.c |    1 +
 src/miners/rss/tracker-miner-rss.c           |    3 +++
 src/tracker-writeback/tracker-writeback.c    |    1 +
 12 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/src/libtracker-common/tracker-dbus.c b/src/libtracker-common/tracker-dbus.c
index 06b4871..b9080b1 100644
--- a/src/libtracker-common/tracker-dbus.c
+++ b/src/libtracker-common/tracker-dbus.c
@@ -394,6 +394,7 @@ tracker_dbus_request_end (TrackerDBusRequest *request,
 
                if (request->cd->n_active_requests == 0) {
                        request->cd->clean_up_id = g_timeout_add_seconds (CLIENT_CLEAN_UP_TIME, 
client_clean_up_cb, request->cd);
+                       g_source_set_name_by_id (request->cd->clean_up_id, "tracker-dbus-client-clean-up");
                }
        }
 
diff --git a/src/libtracker-common/tracker-storage.c b/src/libtracker-common/tracker-storage.c
index 557d002..34d59f0 100644
--- a/src/libtracker-common/tracker-storage.c
+++ b/src/libtracker-common/tracker-storage.c
@@ -836,6 +836,7 @@ mount_pre_removed_cb (GVolumeMonitor *monitor,
        id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE + 10, 3,
                                         unmount_failed_cb,
                                         data, (GDestroyNotify) g_free);
+       g_source_set_name_by_id (id, "tracker-storage-failed-umount-timer");
        g_hash_table_insert (priv->unmount_watchdogs, data->mount,
                             GUINT_TO_POINTER (id));
 }
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index f74c848..c38e4f9 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -1081,6 +1081,7 @@ tracker_crawler_set_throttle (TrackerCrawler *crawler,
                } else {
                        idle_id = g_timeout_add (interval, process_func, crawler);
                }
+               g_source_set_name_by_id (idle_id, "tracker-crawler-processing");
 
                crawler->priv->idle_id = idle_id;
        }
diff --git a/src/libtracker-miner/tracker-media-art.c b/src/libtracker-miner/tracker-media-art.c
index 1be85c2..c61451b 100644
--- a/src/libtracker-miner/tracker-media-art.c
+++ b/src/libtracker-miner/tracker-media-art.c
@@ -230,6 +230,7 @@ tracker_media_art_queue_empty (TrackerSparqlConnection *connection)
                                                       on_timer_callback,
                                                       g_object_ref (connection),
                                                       on_timer_destroy);
+               g_source_set_name_by_id (timer_id, "tracker-media-art-cleanup-timer");
 
                had_any = FALSE;
        }
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 805ecd7..cef50fd 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -653,6 +653,7 @@ tracker_miner_fs_init (TrackerMinerFS *object)
        priv->queue_status_timeout_id = g_timeout_add_seconds (EVENT_QUEUE_STATUS_TIMEOUT_SECS,
                                                               miner_fs_queues_status_trace_timeout_cb,
                                                               object);
+       g_source_set_name_by_id (priv->queue_status_timeout_id, "tracker-processing-pool-trace");
 #endif /* PROCESSING_POOL_ENABLE_TRACE */
 
        priv->items_ignore_next_update = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -2650,6 +2651,8 @@ _tracker_idle_add (TrackerMinerFS *fs,
 static void
 item_queue_handlers_set_up (TrackerMinerFS *fs)
 {
+       gint id;
+
        trace_eq ("Setting up queue handlers...");
        if (fs->priv->item_queues_handler_id != 0) {
                trace_eq ("   cancelled: already one active");
@@ -2703,10 +2706,9 @@ item_queue_handlers_set_up (TrackerMinerFS *fs)
        }
 
        trace_eq ("   scheduled in idle");
-       fs->priv->item_queues_handler_id =
-               _tracker_idle_add (fs,
-                                  item_queue_handlers_cb,
-                                  fs);
+       id = _tracker_idle_add (fs, item_queue_handlers_cb, fs);
+       g_source_set_name_by_id (id, "tracker-miner-fs-item-queue-handler");
+       fs->priv->item_queues_handler_id = id;
 }
 
 static gboolean
@@ -3759,6 +3761,8 @@ void
 tracker_miner_fs_set_throttle (TrackerMinerFS *fs,
                                gdouble         throttle)
 {
+       gint id;
+
        g_return_if_fail (TRACKER_IS_MINER_FS (fs));
 
        throttle = CLAMP (throttle, 0, 1);
@@ -3773,10 +3777,9 @@ tracker_miner_fs_set_throttle (TrackerMinerFS *fs,
        if (fs->priv->item_queues_handler_id != 0) {
                g_source_remove (fs->priv->item_queues_handler_id);
 
-               fs->priv->item_queues_handler_id =
-                       _tracker_idle_add (fs,
-                                          item_queue_handlers_cb,
-                                          fs);
+               id = _tracker_idle_add (fs, item_queue_handlers_cb, fs);
+               g_source_set_name_by_id (id, "tracker-miner-fs-item-queue-handler");
+               fs->priv->item_queues_handler_id = id;
        }
 }
 
diff --git a/src/libtracker-miner/tracker-monitor.c b/src/libtracker-miner/tracker-monitor.c
index 327882f..f1a0156 100644
--- a/src/libtracker-miner/tracker-monitor.c
+++ b/src/libtracker-miner/tracker-monitor.c
@@ -1311,6 +1311,8 @@ monitor_event_cb (GFileMonitor      *file_monitor,
                g_timeout_add_seconds (PAUSE_ON_IO_SECONDS,
                                       unpause_cb,
                                       monitor);
+       g_source_set_name_by_id (monitor->priv->unpause_timeout_id,
+                                "tracker-monitor-pause-for-io-timeout");
 #endif /* PAUSE_ON_IO */
 
        if (!is_directory) {
@@ -1370,6 +1372,8 @@ monitor_event_cb (GFileMonitor      *file_monitor,
                                g_timeout_add_seconds (CACHE_LIFETIME_SECONDS,
                                                       event_pairs_timeout_cb,
                                                       monitor);
+                       g_source_set_name_by_id (monitor->priv->event_pairs_timeout_id,
+                                                "tracker-monitor-event-pairs-timeout");
                }
        } else {
                if (monitor->priv->event_pairs_timeout_id != 0) {
diff --git a/src/libtracker-miner/tracker-sparql-buffer.c b/src/libtracker-miner/tracker-sparql-buffer.c
index e4e5cf7..9cffff8 100644
--- a/src/libtracker-miner/tracker-sparql-buffer.c
+++ b/src/libtracker-miner/tracker-sparql-buffer.c
@@ -187,6 +187,7 @@ static void
 reset_flush_timeout (TrackerSparqlBuffer *buffer)
 {
        TrackerSparqlBufferPrivate *priv;
+       gint id;
 
        priv = buffer->priv;
 
@@ -194,9 +195,9 @@ reset_flush_timeout (TrackerSparqlBuffer *buffer)
                g_source_remove (priv->flush_timeout_id);
        }
 
-       priv->flush_timeout_id = g_timeout_add_seconds (MAX_SPARQL_BUFFER_TIME,
-                                                       flush_timeout_cb,
-                                                       buffer);
+       id = g_timeout_add_seconds (MAX_SPARQL_BUFFER_TIME, flush_timeout_cb, buffer);
+       g_source_set_name_by_id (id, "tracker-sparql-buffer-flush-timeout");
+       priv->flush_timeout_id = id;
 }
 
 static void
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index a2ea8f4..38c2027 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -325,6 +325,7 @@ miner_handle_first (TrackerConfig *config,
        miners_timeout_id = g_timeout_add_seconds (initial_sleep,
                                                   miner_handle_first_cb,
                                                   NULL);
+       g_source_set_name_by_id (miners_timeout_id, "tracker-miner-fs-initial-sleep");
 }
 
 static void
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 7a03a0e..f6cf87b 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1140,6 +1140,8 @@ init_stale_volume_removal (TrackerMinerFiles *miner)
                g_timeout_add_seconds (SECONDS_PER_DAY + 1,
                                       cleanup_stale_removable_volumes_cb,
                                       miner);
+       g_source_set_name_by_id (miner->private->stale_volumes_check_id,
+                                "tracker-miner-fs-stale-removable-volumes-cleanup");
 }
 
 
diff --git a/src/miners/fs/tracker-writeback-dispatcher.c b/src/miners/fs/tracker-writeback-dispatcher.c
index 1d0c5fb..113b38f 100644
--- a/src/miners/fs/tracker-writeback-dispatcher.c
+++ b/src/miners/fs/tracker-writeback-dispatcher.c
@@ -296,6 +296,7 @@ writeback_file_finished  (GObject      *source_object,
                tracker_miner_fs_writeback_notify (data->fs, data->file, NULL);
 
                data->retry_timeout = g_timeout_add_seconds (5, retry_idle, data);
+               g_source_set_name_by_id (data->retry_timeout, "tracker-writback-retry");
                data->retries++;
 
        } else {
diff --git a/src/miners/rss/tracker-miner-rss.c b/src/miners/rss/tracker-miner-rss.c
index cae6b17..18312b2 100644
--- a/src/miners/rss/tracker-miner-rss.c
+++ b/src/miners/rss/tracker-miner-rss.c
@@ -214,6 +214,8 @@ feed_channel_update_data_new (TrackerMinerRSS *miner,
        fcud->timeout_id = g_timeout_add_seconds (2, feed_channel_changed_timeout_cb, fcud);
        fcud->cancellable = g_cancellable_new ();
 
+       g_source_set_name_by_id (fcud->timeout_id, "tracker-miner-rss-feed-channel-changed-timeout");
+
        return fcud;
 }
 
@@ -372,6 +374,7 @@ feed_channel_change_updated_time (FeedItemInsertData *fiid)
                fcud->timeout_id = g_timeout_add_seconds (2,
                                                          feed_channel_changed_timeout_cb,
                                                          fcud);
+               g_source_set_name_by_id (fcud->timeout_id, "tracker-miner-rss-feed-channel-changed-timeout");
        } else {
                /* This is a new update for this channel */
                fcud = feed_channel_update_data_new (fiid->miner, channel);
diff --git a/src/tracker-writeback/tracker-writeback.c b/src/tracker-writeback/tracker-writeback.c
index faf057b..9dc68a7 100644
--- a/src/tracker-writeback/tracker-writeback.c
+++ b/src/tracker-writeback/tracker-writeback.c
@@ -369,6 +369,7 @@ reset_shutdown_timeout (TrackerController *controller)
        g_source_set_callback (source,
                               reset_shutdown_timeout_cb,
                               controller, NULL);
+       g_source_set_name (source, "tracker-writeback-stayalive-timeout");
 
        g_source_attach (source, priv->context);
        priv->shutdown_source = source;


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