[tracker-miners/wip/carlosg/speed-track: 16/22] libtracker-miner: Early out on unchanged files
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/speed-track: 16/22] libtracker-miner: Early out on unchanged files
- Date: Thu, 22 Oct 2020 14:45:56 +0000 (UTC)
commit 8e581a2bc971da39963cae4e17de0c4be6955127
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Oct 17 15:58:16 2020 +0200
libtracker-miner: Early out on unchanged files
Instead of accumulating these files. Remove them from the TrackerFileNotifier
queues as soon as we know the file is unchanged, and at a time we have the
data/node handy.
src/libtracker-miner/tracker-file-notifier.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 3cfe269df..fdc870d5d 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -413,6 +413,7 @@ file_notifier_add_node_foreach (GNode *node,
file_info = tracker_crawler_get_file_info (priv->crawler, file);
if (file_info) {
+ TrackerFileData *file_data;
GFileType file_type;
guint64 _time;
@@ -420,10 +421,18 @@ file_notifier_add_node_foreach (GNode *node,
_time = g_file_info_get_attribute_uint64 (file_info,
G_FILE_ATTRIBUTE_TIME_MODIFIED);
- _insert_disk_info (notifier,
- file,
- file_type,
- _time);
+ file_data = _insert_disk_info (notifier,
+ file,
+ file_type,
+ _time);
+
+ if (file_data->state == FILE_STATE_NONE) {
+ /* If at this point the file has no assigned event,
+ * it didn't get changed, and can be ignored.
+ */
+ g_queue_delete_link (&priv->queue, file_data->node);
+ g_hash_table_remove (priv->cache, file);
+ }
if (file_type == G_FILE_TYPE_DIRECTORY &&
(priv->current_index_root->flags & TRACKER_DIRECTORY_FLAG_RECURSE) != 0 &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]