Drop old messages from TimestampMatcher when not contiguous
Whenever the messages weren't contiguous, we would only remove the
matched message. We know that messages only match going forwards, so we
it is safe to forget about all previous messages too.
Since dropped messages are rare, this code path wasn't well exercised
either. This brings it into alignment with the other code path.
Change-Id: Id123e5cde0280cc1e3f1e575698d88713fc20ec4
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/events/logging/logfile_utils.cc b/aos/events/logging/logfile_utils.cc
index 9c7fe5d..3a825af 100644
--- a/aos/events/logging/logfile_utils.cc
+++ b/aos/events/logging/logfile_utils.cc
@@ -1384,9 +1384,9 @@
<< ": Queue index matches, but timestamp doesn't. Please "
"investigate!";
- // TODO(austin): We still go in order, so we can erase from the beginning to
- // our iterator minus 1. That'll keep 1 in the queue.
- data_queue->erase(it);
+ // Erase everything up to this message. We want to keep 1 message in the
+ // queue so we can handle reliable messages forwarded across boots.
+ data_queue->erase(data_queue->begin(), it);
return result;
}