Don't crash when unable to classify a profile due to some random problem
Random problems include: deleted profiles. Also always wait 10 seconds between runs, we don't need to do it so often
This commit is contained in:
parent
93c4979c71
commit
2fd1474647
|
@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use log::info;
|
use log::{error, info};
|
||||||
|
|
||||||
use crate::services::Bluesky;
|
use crate::services::Bluesky;
|
||||||
use crate::services::Database;
|
use crate::services::Database;
|
||||||
|
@ -37,13 +37,17 @@ impl ProfileClassifier {
|
||||||
let dids = self.database.fetch_unprocessed_profile_dids().await?;
|
let dids = self.database.fetch_unprocessed_profile_dids().await?;
|
||||||
if dids.is_empty() {
|
if dids.is_empty() {
|
||||||
info!("No profiles to process: waiting 10 seconds");
|
info!("No profiles to process: waiting 10 seconds");
|
||||||
tokio::time::sleep(Duration::from_secs(10)).await;
|
|
||||||
} else {
|
} else {
|
||||||
info!("Classifying {} new profiles", dids.len());
|
info!("Classifying {} new profiles", dids.len());
|
||||||
for did in &dids {
|
for did in &dids {
|
||||||
self.fill_in_profile_details(did).await?;
|
match self.fill_in_profile_details(did).await {
|
||||||
|
Ok(()) => continue,
|
||||||
|
Err(e) => error!("Could not classify profile: {:?}", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tokio::time::sleep(Duration::from_secs(10)).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue