[tracker-miners/wip/carlosg/speed-track: 30/40] libtracker-miner: Avoid extra file queries to find hidden files
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/speed-track: 30/40] libtracker-miner: Avoid extra file queries to find hidden files
- Date: Sun, 18 Oct 2020 20:58:43 +0000 (UTC)
commit d107e9edb48f0c99a6cf0324170bc8f55d77f430
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Oct 17 14:01:46 2020 +0200
libtracker-miner: Avoid extra file queries to find hidden files
Delegate this (for the most part) on TrackerCrawler, as it is already
in the business of fetching GFileInfos for inspected files. This avoids
one extra stat() per folder.
src/libtracker-miner/tracker-crawler.c | 3 ++-
src/libtracker-miner/tracker-file-notifier.c | 8 +++++++-
src/libtracker-miner/tracker-indexing-tree.c | 2 +-
src/miners/fs/tracker-main.c | 6 ++++--
4 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index 26b2d3f54..1a89254e6 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -27,7 +27,8 @@
#define FILE_ATTRIBUTES \
G_FILE_ATTRIBUTE_STANDARD_NAME "," \
- G_FILE_ATTRIBUTE_STANDARD_TYPE
+ G_FILE_ATTRIBUTE_STANDARD_TYPE "," \
+ G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN
#define FILES_QUEUE_PROCESS_INTERVAL 2000
#define FILES_QUEUE_PROCESS_MAX 5000
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 626553408..e19a3a1dd 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -853,11 +853,16 @@ create_shallow_file_info (GFile *file,
gboolean is_directory)
{
GFileInfo *file_info;
+ gchar *basename;
file_info = g_file_info_new ();
g_file_info_set_file_type (file_info,
is_directory ?
G_FILE_TYPE_DIRECTORY : G_FILE_TYPE_REGULAR);
+ basename = g_file_get_basename (file);
+ g_file_info_set_is_hidden (file_info, basename[0] == '.');
+ g_free (basename);
+
return file_info;
}
@@ -1291,7 +1296,8 @@ indexing_tree_child_updated (TrackerIndexingTree *indexing_tree,
priv = tracker_file_notifier_get_instance_private (notifier);
child_info = g_file_query_info (child,
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL);
if (!child_info)
diff --git a/src/libtracker-miner/tracker-indexing-tree.c b/src/libtracker-miner/tracker-indexing-tree.c
index 62ea105bb..58338449f 100644
--- a/src/libtracker-miner/tracker-indexing-tree.c
+++ b/src/libtracker-miner/tracker-indexing-tree.c
@@ -892,7 +892,7 @@ tracker_indexing_tree_file_is_indexable (TrackerIndexingTree *tree,
}
if (tracker_indexing_tree_get_filter_hidden (tree) &&
- tracker_file_is_hidden (file)) {
+ info && g_file_info_get_is_hidden (info)) {
return FALSE;
}
diff --git a/src/miners/fs/tracker-main.c b/src/miners/fs/tracker-main.c
index 077a6dbe3..8ae7e321d 100644
--- a/src/miners/fs/tracker-main.c
+++ b/src/miners/fs/tracker-main.c
@@ -596,7 +596,8 @@ check_eligible (void)
/* Start check */
file = g_file_new_for_commandline_arg (eligible);
info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
G_FILE_QUERY_INFO_NONE,
NULL,
&error);
@@ -883,7 +884,8 @@ update_indexed_files_from_proxy (TrackerMinerFiles *miner,
}
file_info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]