Fix Alias cleanup ordering

Update dev.toml
This commit is contained in:
asonix 2023-07-13 19:56:56 -05:00
parent a32355c064
commit afeac8294a
2 changed files with 9 additions and 2 deletions

View file

@ -21,6 +21,11 @@ path = 'data/'
max_file_size = 40
filters = ['blur', 'crop', 'identity', 'resize', 'thumbnail']
[media.animation]
max_width = 2000
max_height = 2000
max_area = 2000000
[media.video]
enable = true
allow_audio = true

View file

@ -95,6 +95,8 @@ where
// TODO: decide if it is okay to skip aliases without tokens
if let Some(token) = repo.delete_token(&alias).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
@ -130,13 +132,13 @@ where
return Err(UploadError::InvalidToken.into());
}
AliasRepo::cleanup(repo, &alias).await?;
let Some(hash) = repo.hash(&alias).await? else {
// hash doesn't exist, nothing to do
return Ok(());
};
AliasRepo::cleanup(repo, &alias).await?;
repo.remove_alias(hash.clone(), &alias).await?;
if repo.aliases(hash.clone()).await?.is_empty() {