log duration of the computing of states

This commit is contained in:
Charles Hall 2024-11-27 22:37:41 -08:00
parent 3afa1ccf8a
commit a86b8f58b0
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -6,6 +6,8 @@ use std::{cmp::Ordering, collections::BTreeSet, sync::Arc};
use ruma::{events::StateEventType, EventId};
use serde::Serialize;
use tokio::time::Instant;
use tracing as t;
use super::GetRoomStatesArgs;
use crate::{
@ -89,12 +91,16 @@ pub(crate) async fn run(
db.apply_migrations().await.map_err(Error::Database)?;
let start = Instant::now();
let room_states = if args.recompute {
recompute::get_room_states(db, &args.select)
} else {
cache::get_room_states(db, &args.select).await
};
t::info!(duration = ?start.elapsed(), "Finished getting states");
serde_json::to_writer(std::io::stdout(), &room_states)?;
Ok(())