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);
};
}
+1 -1
View File
@@ -629,7 +629,7 @@ extern void DLLExport icsneo_discardDeviceEvents(const neodevice_t* device);
* If the error limit is reached, an icsneo::APIEvent::TooManyEvents will be flagged.
*
* If the `newLimit` is smaller than the current error count,
* errors will be removed in order of increasing severity and decreasing age.
* errors will be removed in order of decreasing age.
* This will also flag an icsneo::APIEvent::TooManyEvents.
*/
extern void DLLExport icsneo_setEventLimit(size_t newLimit);