Events are now removed purely in chronological order if overflowing

This commit is contained in:
EricLiu2000
2019-06-27 18:04:59 -04:00
parent 70d5b4f5b5
commit e3517767cb
4 changed files with 35 additions and 67 deletions
+3 -4
View File
@@ -112,8 +112,8 @@ private:
// We are exactly full, either because the list was truncated or because we were simply full before
if(events.size() == eventLimit - 1) {
// If the event is worth adding
if(event.getType() != APIEvent::Type::TooManyEvents && event.getSeverity() >= lowestCurrentSeverity()) {
discardLeastSevere(1);
if(event.getType() != APIEvent::Type::TooManyEvents) {
discardOldest(1);
events.push_back(event);
}
@@ -126,8 +126,7 @@ private:
bool enforceLimit(); // Returns whether the limit enforcement resulted in an overflow
APIEvent::Severity lowestCurrentSeverity() const;
void discardLeastSevere(size_t count = 1);
void discardOldest(size_t count = 1);
};
}