Fix tests

This commit is contained in:
mdecimus
2026-02-18 18:21:54 +00:00
parent 8f2d018bcf
commit 3840a4e28c
3 changed files with 23 additions and 7 deletions

View File

@@ -125,6 +125,7 @@ impl MessageCacheFetch for Server {
let mut changed_items: AHashMap<u32, bool> = AHashMap::with_capacity(changes.changes.len());
let mut changed_containers: AHashMap<u32, bool> =
AHashMap::with_capacity(changes.changes.len());
let mut has_container_property_changes = false;
for change in changes.changes {
match change {
@@ -156,7 +157,9 @@ impl MessageCacheFetch for Server {
Change::DeleteContainer(id) => {
changed_containers.insert(id as u32, false);
}
Change::UpdateContainerProperty(_) => (),
Change::UpdateContainerProperty(_) => {
has_container_property_changes = true;
}
}
}
@@ -172,6 +175,10 @@ impl MessageCacheFetch for Server {
update_mailbox_cache(self, account_id, &changed_containers, &cache).await?;
mailbox_cache.change_id = changes.container_change_id.unwrap_or(changes.to_change_id);
cache.mailboxes = Arc::new(mailbox_cache);
} else if has_container_property_changes {
let mut mailbox_cache = cache.mailboxes.as_ref().clone();
mailbox_cache.change_id = changes.container_change_id.unwrap_or(changes.to_change_id);
cache.mailboxes = Arc::new(mailbox_cache);
}
cache.size = cache.emails.size + cache.mailboxes.size;
cache.last_change_id = changes.to_change_id;

View File

@@ -803,7 +803,13 @@ impl Purge for Server {
// SPDX-License-Identifier: LicenseRef-SEL
#[cfg(feature = "enterprise")]
if let Some(trace_retention) = trace_retention
&& let Err(err) = store
&& let Some(trace_store) = self
.core
.enterprise
.as_ref()
.and_then(|e| e.trace_store.as_ref())
&& let Err(err) = trace_store
.store
.purge_spans(trace_retention, self.search_store().into())
.await
{
@@ -812,7 +818,12 @@ impl Purge for Server {
#[cfg(feature = "enterprise")]
if let Some(metrics_retention) = metrics_retention
&& let Err(err) = store.purge_metrics(metrics_retention).await
&& let Some(metrics_store) = self
.core
.enterprise
.as_ref()
.and_then(|e| e.metrics_store.as_ref())
&& let Err(err) = metrics_store.store.purge_metrics(metrics_retention).await
{
trc::error!(err.details("Failed to purge metrics"));
}

View File

@@ -117,9 +117,7 @@ pub async fn test(params: &mut JMAPTest) {
if change_num % 2 == 0 {
type1_ids.insert(jmap_id);
}
thread_id_map
.entry(jmap_id.prefix_id())
.or_insert(jmap_id);
thread_id_map.entry(jmap_id.prefix_id()).or_insert(jmap_id);
}
LogAction::Update(id) => {
let id = *id_map.get(id).unwrap();
@@ -290,7 +288,7 @@ pub async fn test(params: &mut JMAPTest) {
for item in changes.added() {
let item_id = Id::from_str(item.id()).unwrap();
let id = id_map.iter().find(|(_, v)| **v == item_id).unwrap().0;
assert!(id < &7, "{:?} (id: {})", changes, id);
assert!(id <= &7, "{:?} (id: {})", changes, id);
}
}
if test_num == 4 {