[tracker/wip/carlosg/direct-rewrite] libtracker-miner: Coalesce 2 CREATED events



commit 58cc6255576b1c436545293afbfaf0cb79578348
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Jul 21 17:22:07 2018 +0200

    libtracker-miner: Coalesce 2 CREATED events
    
    It is not even clear this is possible in real life cases, however the
    standalone tracker-file-notifier tests fall into this (due to IRI not being
    ever set, still this is an async op). In the case of 2 consecutive CREATED
    events on the same file, it would be dealt with in TrackerMinerFS as CREATED+
    UPDATED. This was already harmless, but we can do better and swallow one of
    such events.

 src/libtracker-miner/tracker-miner-fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index e8c9de85e..0fbf7c60d 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -775,7 +775,8 @@ queue_event_coalesce (const QueueEvent  *first,
        *replacement = NULL;
 
        if (first->type == TRACKER_MINER_FS_EVENT_CREATED) {
-               if (second->type == TRACKER_MINER_FS_EVENT_UPDATED &&
+               if ((second->type == TRACKER_MINER_FS_EVENT_UPDATED ||
+                    second->type == TRACKER_MINER_FS_EVENT_CREATED) &&
                    first->file == second->file) {
                        return QUEUE_ACTION_DELETE_SECOND;
                } else if (second->type == TRACKER_MINER_FS_EVENT_MOVED &&


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