[tracker-miners/wip/carlosg/shuffle-libtracker-miner: 68/116] libtracker-miner: Coalesce 2 CREATED events



commit 5568b88bbb65b5709310456574767e0aaec0fffe
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 a6627601a..df6150a23 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]