server/upload_path: Refactor

This commit is contained in:
Zhaofeng Li 2023-01-14 23:55:10 -07:00
parent 6d3d07cb14
commit 5a8df0b1e8

View file

@ -161,6 +161,10 @@ async fn upload_path_dedup(
}
}
let file_size = existing_nar.file_size
.map(|dbs| dbs.try_into().map_err(ServerError::database_error))
.transpose()?;
// Finally...
let txn = database
.begin()
@ -188,10 +192,6 @@ async fn upload_path_dedup(
txn.commit().await.map_err(ServerError::database_error)?;
let file_size = existing_nar.file_size
.map(|dbs| dbs.try_into().map_err(ServerError::database_error))
.transpose()?;
// Ensure it's not unlocked earlier
drop(existing_nar);