From 2d5a87e216eda0705d228e032a2bee0c4a8c5a14 Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Tue, 22 Feb 2022 17:27:47 +0100 Subject: [PATCH] Don't apply a limit when getting latest aggregate. --- src/commons/eventsourcing/store.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/commons/eventsourcing/store.rs b/src/commons/eventsourcing/store.rs index 58483c6c..dd875fcc 100644 --- a/src/commons/eventsourcing/store.rs +++ b/src/commons/eventsourcing/store.rs @@ -640,15 +640,8 @@ where fn get_latest_no_lock(&self, handle: &Handle) -> StoreResult> { trace!("Trying to load aggregate id: {}", handle); - let info_key = Self::key_for_info(handle); - let limit = self - .kv - .get::(&info_key) - .map_err(|_| AggregateStoreError::InfoCorrupt(handle.clone()))? - .map(|info| info.last_event); - match self.cache_get(handle) { - None => match self.get_aggregate(handle, limit)? { + None => match self.get_aggregate(handle, None)? { None => { error!("Could not load aggregate with id: {} from disk", handle); Err(AggregateStoreError::UnknownAggregate(handle.clone())) @@ -663,7 +656,7 @@ where Some(mut arc) => { if self.has_updates(handle, &arc)? { let agg = Arc::make_mut(&mut arc); - self.update_aggregate(handle, agg, limit)?; + self.update_aggregate(handle, agg, None)?; } trace!("Loaded aggregate id: {} from memory", handle); Ok(arc)