add option to recompute room state

Hopefully we can make use of this state resolution code for more stuff
in the future.
This commit is contained in:
Charles Hall 2024-11-02 18:26:00 -07:00
parent 33598a79b7
commit b1e14fad5c
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
5 changed files with 629 additions and 1 deletions

View file

@ -13,6 +13,7 @@ use crate::{
};
mod cache;
mod recompute;
/// Serializable information about a state event
#[derive(Serialize, PartialEq, Eq)]
@ -63,7 +64,11 @@ pub(crate) async fn run(
db.apply_migrations().await.map_err(Error::Database)?;
let room_states = cache::get_room_states().await;
let room_states = if args.recompute {
recompute::get_room_states(db)
} else {
cache::get_room_states().await
};
serde_json::to_writer(std::io::stdout(), &room_states)?;