Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 77e3537

Browse files
grtlrAlex6323
andauthored
fix(analytics): computation of daily active addresses (#1005)
* fix(analytics): computation of daily active addresses * add debug assert * fmt Co-authored-by: /alex/ <[email protected]>
1 parent 08c9fb4 commit 77e3537

File tree

1 file changed

+12
-1
lines changed
  • src/bin/inx-chronicle/stardust_inx

1 file changed

+12
-1
lines changed

src/bin/inx-chronicle/stardust_inx/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ pub async fn gather_analytics(
4949
) -> Result<(), InxWorkerError> {
5050
let mut tasks = JoinSet::new();
5151

52+
let len_before = analytics.len();
53+
5254
for analytic in analytics.drain(..) {
5355
let mongodb = mongodb.clone();
5456
let influxdb = influxdb.clone();
@@ -69,6 +71,12 @@ pub async fn gather_analytics(
6971
analytics.push(res.unwrap()?);
7072
}
7173

74+
debug_assert_eq!(
75+
len_before,
76+
analytics.len(),
77+
"The number of analytics should never change."
78+
);
79+
7280
Ok(())
7381
}
7482

@@ -117,13 +125,16 @@ impl InxWorker {
117125

118126
debug!("Started listening to ledger updates via INX.");
119127

128+
#[cfg(feature = "analytics")]
129+
let mut analytics = chronicle::db::collections::analytics::all_analytics();
130+
120131
while let Some(ledger_update) = stream.try_next().await? {
121132
self.handle_ledger_update(
122133
&mut inx,
123134
ledger_update,
124135
&mut stream,
125136
#[cfg(feature = "analytics")]
126-
&mut chronicle::db::collections::analytics::all_analytics(),
137+
&mut analytics,
127138
)
128139
.await?;
129140
}

0 commit comments

Comments
 (0)