Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(analytics): computation of daily active addresses #1005

Merged
merged 5 commits into from
Jan 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/bin/inx-chronicle/stardust_inx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pub async fn gather_analytics(
) -> Result<(), InxWorkerError> {
let mut tasks = JoinSet::new();

let len_before = analytics.len();

for analytic in analytics.drain(..) {
let mongodb = mongodb.clone();
let influxdb = influxdb.clone();
Expand All @@ -69,6 +71,12 @@ pub async fn gather_analytics(
analytics.push(res.unwrap()?);
}

debug_assert_eq!(
len_before,
analytics.len(),
"The number of analytics should never change."
);

Ok(())
}

Expand Down Expand Up @@ -117,13 +125,16 @@ impl InxWorker {

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

#[cfg(feature = "analytics")]
let mut analytics = chronicle::db::collections::analytics::all_analytics();

while let Some(ledger_update) = stream.try_next().await? {
self.handle_ledger_update(
&mut inx,
ledger_update,
&mut stream,
#[cfg(feature = "analytics")]
&mut chronicle::db::collections::analytics::all_analytics(),
&mut analytics,
)
.await?;
}
Expand Down