Ignore error if profile re-fetching fails
This commit is contained in:
parent
a82f3c4ff0
commit
bc1b73dd24
1 changed files with 22 additions and 11 deletions
|
@ -98,15 +98,26 @@ pub async fn get_or_import_profile_by_actor_id(
|
||||||
let profile = match get_profile_by_actor_id(db_client, actor_id).await {
|
let profile = match get_profile_by_actor_id(db_client, actor_id).await {
|
||||||
Ok(profile) => {
|
Ok(profile) => {
|
||||||
if profile.possibly_outdated() {
|
if profile.possibly_outdated() {
|
||||||
let actor = fetch_actor(instance, actor_id).await?;
|
// Try to re-fetch actor profile
|
||||||
log::info!("re-fetched profile {}", profile.acct);
|
match fetch_actor(instance, actor_id).await {
|
||||||
let profile = update_remote_profile(
|
Ok(actor) => {
|
||||||
db_client,
|
log::info!("re-fetched profile {}", profile.acct);
|
||||||
media_dir,
|
let profile_updated = update_remote_profile(
|
||||||
profile,
|
db_client,
|
||||||
actor,
|
media_dir,
|
||||||
).await?;
|
profile,
|
||||||
profile
|
actor,
|
||||||
|
).await?;
|
||||||
|
profile_updated
|
||||||
|
},
|
||||||
|
Err(err) => {
|
||||||
|
// Ignore error and return stored profile
|
||||||
|
log::warn!(
|
||||||
|
"failed to re-fetch {} ({})", profile.acct, err,
|
||||||
|
);
|
||||||
|
profile
|
||||||
|
},
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
profile
|
profile
|
||||||
}
|
}
|
||||||
|
@ -119,13 +130,13 @@ pub async fn get_or_import_profile_by_actor_id(
|
||||||
Ok(profile) => {
|
Ok(profile) => {
|
||||||
// WARNING: Possible actor ID change
|
// WARNING: Possible actor ID change
|
||||||
log::info!("re-fetched profile {}", profile.acct);
|
log::info!("re-fetched profile {}", profile.acct);
|
||||||
let profile = update_remote_profile(
|
let profile_updated = update_remote_profile(
|
||||||
db_client,
|
db_client,
|
||||||
media_dir,
|
media_dir,
|
||||||
profile,
|
profile,
|
||||||
actor,
|
actor,
|
||||||
).await?;
|
).await?;
|
||||||
profile
|
profile_updated
|
||||||
},
|
},
|
||||||
Err(DatabaseError::NotFound(_)) => {
|
Err(DatabaseError::NotFound(_)) => {
|
||||||
let mut profile_data = prepare_remote_profile_data(
|
let mut profile_data = prepare_remote_profile_data(
|
||||||
|
|
Loading…
Reference in a new issue