2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-26 04:21:25 +00:00

Fix alias cleanup ordering

This commit is contained in:
asonix 2023-07-13 19:59:39 -05:00
parent 39067c885b
commit 4a407afd9f

View file

@ -95,6 +95,8 @@ where
// TODO: decide if it is okay to skip aliases without tokens // TODO: decide if it is okay to skip aliases without tokens
if let Some(token) = repo.delete_token(&alias).await? { if let Some(token) = repo.delete_token(&alias).await? {
super::cleanup_alias(repo, alias, token).await?; super::cleanup_alias(repo, alias, token).await?;
} else {
tracing::warn!("Not cleaning alias!");
} }
} }
// Return after queueing cleanup alias, since we will be requeued when the last alias is cleaned // Return after queueing cleanup alias, since we will be requeued when the last alias is cleaned
@ -130,9 +132,11 @@ where
return Err(UploadError::InvalidToken.into()); return Err(UploadError::InvalidToken.into());
} }
let hash = repo.hash(&alias).await?;
AliasRepo::cleanup(repo, &alias).await?; AliasRepo::cleanup(repo, &alias).await?;
let Some(hash) = repo.hash(&alias).await? else { let Some(hash) = hash else {
// hash doesn't exist, nothing to do // hash doesn't exist, nothing to do
return Ok(()); return Ok(());
}; };