only keep 20 (or so) most recent events
@@ -8,9 +8,10 @@ SKDelta::SKDelta(const String& hostname, int max_buffer_size)
max_buffer_size{max_buffer_size} {}
void SKDelta::append(const String val) {
- if (buffer.size() < max_buffer_size) {
- buffer.push_front(val);
+ if (buffer.size() >= max_buffer_size) {
+ buffer.pop_back();
}
+ buffer.push_front(val);
}
bool SKDelta::data_available() {
