···8383 let mut total = 0;
84848585 loop {
8686+ // todo this won't hold up after the backfill as it'll be slower
8787+ // and we likely won't get full batches.
8888+ if total % 500_000 == 0 {
8989+ println!("refreshing stats at {} ops", total);
9090+9191+ tokio::task::spawn_blocking({
9292+ let db = db.clone();
9393+ let mut stats = stats.clone().write_owned().await;
9494+ // todo this does make the api unavailable while it's working
9595+ // as the rwlock doesn't allow any readers while a writer is open
9696+ move || async move { stats.refresh(&db) }
9797+ })
9898+ .await?
9999+ .await?;
100100+ }
101101+86102 println!("seen {} this session with seq {}", total, after);
87103 let url = format!("https://plc.directory/export?count=1000&after={}", after);
88104