mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +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> {
|
pub fn checked_sub(self, other: Self) -> Option<Self> {
|
||||||
Some(Self { resident: self.resident.checked_sub(other.resident)? })
|
Some(Self { resident: self.resident.checked_sub(other.resident)? })
|
||||||
}
|
}
|
||||||
|
@ -96,14 +96,8 @@ impl TraceLayer {
|
|||||||
self.start_time.elapsed()
|
self.start_time.elapsed()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
|
||||||
fn memory_stats(&self) -> Option<MemoryStats> {
|
fn memory_stats(&self) -> Option<MemoryStats> {
|
||||||
Some(MemoryStats::fetch().unwrap())
|
MemoryStats::fetch()
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
|
||||||
fn memory_stats(&self) -> Option<MemoryStats> {
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send(&self, entry: Entry) {
|
fn send(&self, entry: Entry) {
|
||||||
|
Loading…
Reference in New Issue
Block a user