mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 23:31:24 +01:00
log duration of the computing of states
This commit is contained in:
parent
3afa1ccf8a
commit
a86b8f58b0
1 changed files with 6 additions and 0 deletions
|
|
@ -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(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue