v0.33.8
This commit is contained in:
1 parent
6b937aaf85
commit
87c8393d86
79 files changed
+6727
-297
No files matched your search
+13
-6
@@ -136,14 +136,21 @@ impl Logs {
|
||||
self.settings.load().capture_country
|
||||
}
|
||||
pub fn push(&self, entry: LogEntry) {
|
||||
if let Ok(mut entries) = self.entries.try_lock() {
|
||||
if entries.len() == HISTORY_CAPACITY {
|
||||
entries.pop_front();
|
||||
}
|
||||
entries.push_back(entry.clone());
|
||||
// String cloning and eviction cleanup do not need the history mutex.
|
||||
let history_entry = entry.clone();
|
||||
let evicted = if let Ok(mut entries) = self.entries.try_lock() {
|
||||
let evicted = if entries.len() == HISTORY_CAPACITY {
|
||||
entries.pop_front()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
entries.push_back(history_entry);
|
||||
evicted
|
||||
} else {
|
||||
self.dropped.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
None
|
||||
};
|
||||
drop(evicted);
|
||||
let _ = self.live.send(entry.clone());
|
||||
self.push_sink(entry);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user