mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-29 16:45:30 +08:00
struct destructuring for HealthAggregator
This commit is contained in:
parent
5831466525
commit
1faee92748
@ -1570,17 +1570,19 @@ impl HealthAggregator {
|
|||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Aggregate one [DocumentsAggregator] into another.
|
/// Aggregate one [HealthAggregator] into another.
|
||||||
pub fn aggregate(&mut self, other: Self) {
|
pub fn aggregate(&mut self, other: Self) {
|
||||||
|
let Self { timestamp, user_agents, total_received } = other;
|
||||||
|
|
||||||
if self.timestamp.is_none() {
|
if self.timestamp.is_none() {
|
||||||
self.timestamp = other.timestamp;
|
self.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we can't create a union because there is no `into_union` method
|
// we can't create a union because there is no `into_union` method
|
||||||
for user_agent in other.user_agents {
|
for user_agent in user_agents {
|
||||||
self.user_agents.insert(user_agent);
|
self.user_agents.insert(user_agent);
|
||||||
}
|
}
|
||||||
self.total_received = self.total_received.saturating_add(other.total_received);
|
self.total_received = self.total_received.saturating_add(total_received);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_event(self, user: &User, event_name: &str) -> Option<Track> {
|
pub fn into_event(self, user: &User, event_name: &str) -> Option<Track> {
|
||||||
|
Loading…
Reference in New Issue
Block a user