[tracker-miners/wip/carlosg/miner-files-queues: 5/10] libtracker-miner: Notify created/updated files soon




commit 98e5e0229c9f37dad2c1e9aa022c37bc0e2c39bf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Dec 16 14:07:36 2021 +0100

    libtracker-miner: Notify created/updated files soon
    
    Let the files found during crawling (either created or updated, and
    we already know that by merging the information with database queries)
    be notified before waiting for the whole index root to be finished.
    
    This allows early handling from the TrackerMinerFS side, and some way
    to let it control the "high water" hint if there are too many files
    being queued. Otherwise all files found are added at once, and the
    "high water" hint becomes moot.

 src/libtracker-miner/tracker-file-notifier.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-file-notifier.c b/src/libtracker-miner/tracker-file-notifier.c
index 5815753cb..52595f17b 100644
--- a/src/libtracker-miner/tracker-file-notifier.c
+++ b/src/libtracker-miner/tracker-file-notifier.c
@@ -441,14 +441,6 @@ file_notifier_add_node_foreach (GNode    *node,
                                               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 &&
                    !G_NODE_IS_ROOT (node)) {
@@ -457,6 +449,15 @@ file_notifier_add_node_foreach (GNode    *node,
                        g_queue_push_tail (priv->current_index_root->pending_dirs,
                                           g_object_ref (file));
                }
+
+               g_object_ref (file);
+               g_queue_delete_link (&priv->queue, file_data->node);
+
+               if (file_data->state != FILE_STATE_NONE)
+                       file_notifier_notify (file, file_data, notifier);
+
+               g_hash_table_remove (priv->cache, file);
+               g_object_unref (file);
        }
 
        return FALSE;


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