dont return "Allocator" header for server memory-usage if empty

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-05-01 21:50:46 -04:00 committed by June
parent 0f13ada300
commit c4beb7d462

View file

@ -31,7 +31,12 @@ pub(crate) async fn memory_usage(_body: Vec<&str>) -> Result<RoomMessageEventCon
let response2 = crate::alloc::memory_usage();
Ok(RoomMessageEventContent::text_plain(format!(
"Services:\n{response0}\n\nDatabase:\n{response1}\nAllocator:\n{response2}"
"Services:\n{response0}\n\nDatabase:\n{response1}\n{}",
if !response2.is_empty() {
"Allocator:\n{response2}"
} else {
""
}
)))
}