From 2d65a0b8e9d517281dca77251fecbb122fe0bd00 Mon Sep 17 00:00:00 2001 From: Matt Greenfield Date: Tue, 29 May 2018 14:31:38 +0700 Subject: [PATCH] timeline segments shouldn't process items if they overlap with the recorder's zone of responsibility #11 --- LocoKit/LocalStore/TimelineSegment.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/LocoKit/LocalStore/TimelineSegment.swift b/LocoKit/LocalStore/TimelineSegment.swift index be650054..c4cda3d9 100644 --- a/LocoKit/LocalStore/TimelineSegment.swift +++ b/LocoKit/LocalStore/TimelineSegment.swift @@ -132,9 +132,13 @@ public class TimelineSegment: TransactionObserver { } private func process() { - if let items = timelineItems { - TimelineProcessor.process(items) - } + guard let items = timelineItems else { return } + + // shouldn't do processing if currentItem is in the segment and isn't a keeper + // (the TimelineRecorder should be the sole authority on processing those cases) + for item in items { if item.isCurrentItem && !item.isWorthKeeping { return } } + + TimelineProcessor.process(items) } // MARK: - TransactionObserver