Remove instance filtering/sorting

This commit is contained in:
Felix Ableitner 2021-03-11 12:22:28 +01:00
parent 71cdf40bae
commit f3876b4745

View file

@ -15,7 +15,6 @@ pub async fn main() -> Result<(), Error> {
eprintln!("Crawling...");
let instance_details = crawl(start_instances).await?;
let instance_details = cleanup(instance_details);
let total_stats = aggregate(instance_details);
println!("{}", serde_json::to_string(&total_stats)?);
@ -47,16 +46,6 @@ fn aggregate(instance_details: Vec<InstanceDetails>) -> TotalStats {
}
}
fn cleanup(instance_details: Vec<InstanceDetails>) -> Vec<InstanceDetails> {
let mut instance_details: Vec<InstanceDetails> = instance_details
.iter()
.filter(|i| i.open_registrations)
.map(|i| i.to_owned())
.collect();
instance_details.sort_by(|a, b| b.users_active_halfyear.cmp(&a.users_active_halfyear));
instance_details
}
async fn crawl(start_instances: Vec<String>) -> Result<Vec<InstanceDetails>, Error> {
let mut pending_instances = start_instances;
let mut instance_details = vec![];