mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
Simplify MemoryStats fetching
This commit is contained in:
parent
4de2db6786
commit
f3c34d5b8c
@ -121,6 +121,11 @@ impl MemoryStats {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
pub fn fetch() -> Option<Self> {
|
||||
None
|
||||
}
|
||||
|
||||
pub fn checked_sub(self, other: Self) -> Option<Self> {
|
||||
Some(Self { resident: self.resident.checked_sub(other.resident)? })
|
||||
}
|
||||
|
@ -96,14 +96,8 @@ impl TraceLayer {
|
||||
self.start_time.elapsed()
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
fn memory_stats(&self) -> Option<MemoryStats> {
|
||||
Some(MemoryStats::fetch().unwrap())
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
fn memory_stats(&self) -> Option<MemoryStats> {
|
||||
None
|
||||
MemoryStats::fetch()
|
||||
}
|
||||
|
||||
fn send(&self, entry: Entry) {
|
||||
|
Loading…
Reference in New Issue
Block a user